]> git.ozlabs.org Git - ccan/blobdiff - tools/_infotojson/utils.c
Remove _infotojson (unused for now)
[ccan] / tools / _infotojson / utils.c
diff --git a/tools/_infotojson/utils.c b/tools/_infotojson/utils.c
deleted file mode 100644 (file)
index 4f2fc43..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#define _GNU_SOURCE
-#include <stdio.h>
-#include "utils.h"
-#include <string.h>
-#include <limits.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <err.h>
-#include <assert.h>
-#include "utils.h"
-
-void * palloc(int size)
-{
-       void *p;
-       p = malloc(size);
-       if(p == NULL) {
-               printf("Error Malloc does not allocate\n");
-               exit(1);
-       }
-       return p;
-}
-
-char *aprintf(const char *fmt, ...)
-{
-       char *ret;
-       va_list arglist;
-
-       va_start(arglist, fmt);
-       vasprintf(&ret, fmt, arglist);
-       va_end(arglist);
-       return ret;
-}
-
-void strreplace(char * str, char src, char dest)
-{
-       int i;
-       for(i = 0; str[i]; i++)
-               if(str[i] == src)
-                       str[i] = dest;
-}
-
-void *_realloc_array(void *ptr, size_t size, size_t num)
-{
-        if (num >= SIZE_MAX/size)
-                return NULL;
-        return realloc_nofail(ptr, size * num);
-}
-
-void *realloc_nofail(void *ptr, size_t size)
-{
-        ptr = realloc(ptr, size);
-       if (ptr)
-               return ptr;
-       err(1, "realloc of %zu failed", size);
-}