util.c
changeset 84 052fe7498930
parent 76 4bd49f404f10
child 92 4bee0aa5b286
equal deleted inserted replaced
83:ca809fdd30ea 84:052fe7498930
     8 #include <stdio.h>
     8 #include <stdio.h>
     9 #include <stdlib.h>
     9 #include <stdlib.h>
    10 #include <sys/wait.h>
    10 #include <sys/wait.h>
    11 #include <unistd.h>
    11 #include <unistd.h>
    12 
    12 
    13 /* static functions */
    13 /* static */
    14 
    14 
    15 static void
    15 static void
    16 bad_malloc(unsigned int size)
    16 bad_malloc(unsigned int size)
    17 {
    17 {
    18 	fprintf(stderr, "fatal: could not malloc() %d bytes\n",
    18 	fprintf(stderr, "fatal: could not malloc() %d bytes\n",
    19 			(int) size);
    19 			(int) size);
    20 	exit(1);
    20 	exit(1);
    21 }
    21 }
    22 
    22 
    23 /* extern functions */
    23 /* extern */
    24 
    24 
    25 void *
    25 void *
    26 emallocz(unsigned int size)
    26 emallocz(unsigned int size)
    27 {
    27 {
    28 	void *res = calloc(1, size);
    28 	void *res = calloc(1, size);