]> andersk Git - moira.git/commitdiff
strsave: Kludged up null ptr handling for compat with version in dcm.
authorwesommer <wesommer>
Thu, 3 Sep 1987 02:29:18 +0000 (02:29 +0000)
committerwesommer <wesommer>
Thu, 3 Sep 1987 02:29:18 +0000 (02:29 +0000)
Linted.

lib/strs.c

index 86f96c9e1dd689e1e6c77f2b47c4caf8b0149831..284c1f367cc3072e3832435287c2ec167f1b4fb9 100644 (file)
 static char *rcsid_strs_c = "$Header$";
 #endif lint
 
+#include <sys/types.h>
+#include <strings.h>
+#include <ctype.h>
+
+extern char *malloc(), *realloc();
 
 /*
  * Random string functions which should be in the C library..
@@ -24,8 +29,17 @@ char *
 strsave(s)
     char *s;
 {
-    register int len = strlen(s) + 1;
-    register char *p = malloc((u_int)len);
+    register int len;
+    register char *p;
+    /* Kludge for sloppy string semantics */
+    if (!s) {
+           printf("NULL != \"\" !!!!\r\n");
+           p = malloc(1);
+           *p = "\0";
+           return p;
+    }
+    len = strlen(s) + 1;
+    p = malloc((u_int)len);
     if (p) bcopy(s, p, len);
     return p;
 }
This page took 0.05139 seconds and 5 git commands to generate.