]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
*** empty log message ***
authorGuido van Rossum <guido@python.org>
Thu, 29 Aug 1996 17:48:26 +0000 (17:48 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 29 Aug 1996 17:48:26 +0000 (17:48 +0000)
Python/strdup.c [new file with mode: 0644]

diff --git a/Python/strdup.c b/Python/strdup.c
new file mode 100644 (file)
index 0000000..5198e25
--- /dev/null
@@ -0,0 +1,22 @@
+/* strdup() replacement (from stdwin, if you must know) */
+
+#include "config.h"
+#include <string.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern ANY *malloc Py_PROTO((size_t));
+#endif
+
+char *
+strdup(str)
+       const char *str;
+{
+       if (str != NULL) {
+               register char *copy = malloc(strlen(str) + 1);
+               if (copy != NULL)
+                       return strcpy(copy, str);
+       }
+       return NULL;
+}