version 1.4, 2016/09/30 08:43:23 |
version 1.5, 2017/01/03 07:25:16 |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
#include <fcntl.h> |
#include "utils.h" |
#include "utils.h" |
|
|
/* |
/* |
|
|
} |
} |
|
|
/* |
/* |
* store a unsigned decimal in the log |
* store an unsigned decimal in the log |
*/ |
*/ |
void |
void |
log_putu(unsigned long num) |
log_putu(unsigned long num) |
|
|
} |
} |
|
|
/* |
/* |
* allocate a (small) abount of memory, and abort if it fails |
* allocate a (small) amount of memory, and abort if it fails |
*/ |
*/ |
void * |
void * |
xmalloc(size_t size) |
xmalloc(size_t size) |
|
|
panic(); |
panic(); |
} |
} |
return p; |
return p; |
|
} |
|
|
|
/* |
|
* free memory allocated with xmalloc() |
|
*/ |
|
void |
|
xfree(void *p) |
|
{ |
|
#ifdef DEBUG |
|
if (p == NULL) { |
|
log_puts("xfree with NULL arg\n"); |
|
panic(); |
|
} |
|
#endif |
|
free(p); |
} |
} |
|
|
/* |
/* |