head and tail now operate on strings

This commit is contained in:
2014-06-16 18:17:04 +01:00
parent 0c138cfe20
commit 12e830884e
3 changed files with 31 additions and 2 deletions

3
util.c
View File

@@ -4,7 +4,8 @@
#include "util.h"
char * strdup(char* s) {
char *d = calloc(1, strlen (s) + 1);
if (s == NULL) return NULL;
char *d = calloc(strlen (s) + 1, sizeof(char));
if (d == NULL) return NULL;
strcpy (d,s);
return d;