sync utils.c to sndiod one

This commit is contained in:
Alexandre Ratchov 2017-01-03 08:20:49 +01:00
parent 209e88bbde
commit 2f5165d92f
1 changed files with 9 additions and 2 deletions

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include "utils.h"
/*
@ -95,7 +96,7 @@ log_putx(unsigned long num)
}
/*
* store a unsigned decimal in the log
* store an unsigned decimal in the log
*/
void
log_putu(unsigned long num)
@ -139,7 +140,7 @@ panic(void)
}
/*
* allocate a (small) abount of memory, and abort if it fails
* allocate a (small) amount of memory, and abort if it fails
*/
void *
xmalloc(size_t size)
@ -162,6 +163,12 @@ xmalloc(size_t size)
void
xfree(void *p)
{
#ifdef DEBUG
if (p == NULL) {
log_puts("xfree with NULL arg\n");
panic();
}
#endif
free(p);
}