version 1.4, 2000/10/13 08:29:20 |
version 1.5, 2001/05/03 13:41:04 |
|
|
|
/* $OpenPackages$ */ |
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
|
|
/* |
/* |
|
|
#include <unistd.h> |
#include <unistd.h> |
#include "error.h" |
#include "error.h" |
|
|
static void enomem __P((size_t)); |
#ifdef __GNUC__ |
|
#define UNUSED __attribute__((unused)) |
|
#else |
|
#define UNUSED |
|
#endif |
|
|
|
static void enomem(size_t); |
|
|
/* |
/* |
* emalloc -- |
* emalloc -- |
* malloc, but die on error. |
* malloc, but die on error. |
|
|
void * |
void * |
hash_alloc(s, u) |
hash_alloc(s, u) |
size_t s; |
size_t s; |
void *u; |
void *u UNUSED; |
{ |
{ |
return ecalloc(s, 1); |
return ecalloc(s, 1); |
} |
} |
|
|
void |
void |
hash_free(p, s, u) |
hash_free(p, s, u) |
void *p; |
void *p; |
size_t s; |
size_t s UNUSED; |
void *u; |
void *u UNUSED; |
{ |
{ |
free(p); |
free(p); |
} |
} |
|
|
void * |
void * |
element_alloc(s, u) |
element_alloc(s, u) |
size_t s; |
size_t s; |
void *u; |
void *u UNUSED; |
{ |
{ |
return emalloc(s); |
return emalloc(s); |
} |
} |
|
|
|
|
|
|
/* |
/* |
* enomem -- |
* enomem -- |
* die when out of memory. |
* die when out of memory. |
|
|
exit(2); |
exit(2); |
} |
} |
|
|
|
|
/* |
/* |
* enunlink -- |
* enunlink -- |
* Remove a file carefully, avoiding directories. |
* Remove a file carefully, avoiding directories. |
|
|
} |
} |
return unlink(file); |
return unlink(file); |
} |
} |
|
|