mirror of https://github.com/ericonr/sndio.git
sync utils.c to sndiod one
This commit is contained in:
parent
209e88bbde
commit
2f5165d92f
|
@ -24,6 +24,7 @@
|
||||||
#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"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -95,7 +96,7 @@ log_putx(unsigned long num)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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)
|
||||||
|
@ -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 *
|
void *
|
||||||
xmalloc(size_t size)
|
xmalloc(size_t size)
|
||||||
|
@ -162,6 +163,12 @@ xmalloc(size_t size)
|
||||||
void
|
void
|
||||||
xfree(void *p)
|
xfree(void *p)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
if (p == NULL) {
|
||||||
|
log_puts("xfree with NULL arg\n");
|
||||||
|
panic();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue