69 #if HAVE_ASSERT_H == 1 72 #error assert.h is needed to build this package 75 #if HAVE_UNISTD_H == 1 85 #error stdlib.h is needed to build this package 88 #if HAVE_STRING_H == 1 91 #error string.h is needed to build this package 94 #if HAVE_INTTYPES_H == 1 97 #error inttypes.h is needed to build this package 104 #if defined(_WIN32) && !defined(__USE_MINGW_ANSI_STDIO) 123 #if defined(__GNUC__) 124 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 7 125 #define UTIL_UNUSED __attribute__ ((unused)) 136 #define NIL(type) ((type *) 0) 160 #define ALLOC(type, num) \ 161 ((type *) malloc(sizeof(type) * (num))) 162 #define REALLOC(type, obj, num) \ 163 ((type *) realloc(obj, sizeof(type) * (num))) 166 #define ALLOC(type, num) \ 167 ((type *) MMalloc(sizeof(type) * (size_t) (num))) 168 #define REALLOC(type, obj, num) \ 169 ((type *) MMrealloc((obj), sizeof(type) * (size_t) (num))) 172 #define FREE(obj) (free(obj), (obj) = 0) 178 (void) fprintf(stderr, "Fatal error: file %s, line %d\n%s\n",\ 179 __FILE__, __LINE__, why);\ 180 (void) fflush(stdout);\ 188 #define ABS(a) ((a) < 0 ? -(a) : (a)) 192 #define MAX(a,b) ((a) > (b) ? (a) : (b)) 196 #define MIN(a,b) ((a) < (b) ? (a) : (b)) 201 typedef int (*
QSFP)(
void const *,
void const *);
223 extern void util_qsort (
void *vbase,
int n,
int size,
QSFP compar);
224 extern int util_pipefork(
char *
const * argv, FILE ** toCommand,
225 FILE ** fromCommand,
int * pid);
void(* MMoutOfMemory)(size_t)
Global out-of-memory handler.
Definition: safe_mem.c:79
void * MMrealloc(void *, size_t)
realloc replacement.
Definition: safe_mem.c:119
void * MMalloc(size_t)
malloc replacement.
Definition: safe_mem.c:103
void util_qsort(void *vbase, int n, int size, QSFP compar)
Implements the quicksort algorithm.
Definition: ucbqsort.c:123
int util_pipefork(char *const *argv, FILE **toCommand, FILE **fromCommand, int *pid)
Forks a command and sets up pipes to and from.
Definition: pipefork.c:98
int(* QSFP)(void const *, void const *)
Type of comparison functions for util_qsort.
Definition: util.h:201
char * util_file_search(char const *, char *, char const *)
Searches for a file given a set of paths.
Definition: pathsearch.c:91
void MMout_of_memory(size_t)
Out of memory for lazy people: flush and exit.
Definition: safe_mem.c:90
long util_cpu_time(void)
returns a long which represents the elapsed processor time in milliseconds since some constant refere...
Definition: cpu_time.c:82
long util_cpu_ctime(void)
returns a long which represents the elapsed processor time in milliseconds since some constant refere...
Definition: cpu_time.c:118
size_t getSoftDataLimit(void)
Gets the soft datasize limit.
Definition: datalimit.c:89
void util_print_cpu_stats(FILE *)
Prints CPU statistics.
Definition: cpu_stats.c:98
char * util_tilde_expand(char const *)
Expands tilde in a file name.
Definition: texpand.c:75
char * util_strsav(char const *)
Returns a copy of a string.
Definition: strsav.c:71
char * util_print_time(unsigned long)
Massages a long that represents a time interval in milliseconds into a string suitable for output...
Definition: prtime.c:74
char * util_path_search(char const *)
Looks for a program in the directories specified by PATH.
Definition: pathsearch.c:77