initial commit

This commit is contained in:
TLINDEN
2013-10-28 22:50:05 +01:00
parent 92c0dcbebf
commit 2d7babae35
113 changed files with 61619 additions and 4 deletions

33
libpcp/mem.c Normal file
View File

@@ -0,0 +1,33 @@
#include "mem.h"
#include <stdio.h>
void *ucmalloc(size_t s) {
size_t size = s * sizeof(unsigned char);
void *value = malloc (size);
if (value == NULL) {
err(errno, "Cannot allocate memory");
exit(-1);
}
bzero (value, size);
//printf("allocated %d bytes at %p\n", (int)size, value);
return value;
}
void *urmalloc(size_t s) {
void *value = ucmalloc (s);
arc4random_buf(value, s);
return value;
}
void *ucfree(void *ptr) {
free(ptr);
ptr = NULL;
}