]> granicus.if.org Git - sudo/commitdiff
No longer need strdup() or strndup() replacements.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 3 May 2010 21:56:06 +0000 (17:56 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 3 May 2010 21:56:06 +0000 (17:56 -0400)
compat/Makefile.in
compat/strdup.c [deleted file]
compat/strndup.c [deleted file]

index 402d27e0a960cf27741507f9aa52df4243726e6a..090d7fbe3a27bff4a82d8b6838eb5a48c970ee1e 100644 (file)
@@ -91,8 +91,6 @@ nanosleep.lo: $(compat)/nanosleep.c $(incdir)/compat.h $(top_builddir)/config.h
 sigaction.lo: $(compat)/sigaction.c $(incdir)/compat.h $(incdir)/compat.h
 snprintf.lo: $(compat)/snprintf.c $(incdir)/compat.h $(top_builddir)/config.h
 strcasecmp.lo: $(compat)/strcasecmp.c $(incdir)/compat.h $(top_builddir)/config.h
-strdup.lo: $(compat)/strdup.c $(incdir)/compat.h $(top_builddir)/config.h
-strndup.lo: $(compat)/strdup.c $(incdir)/compat.h $(top_builddir)/config.h
 strerror.lo: $(compat)/strerror.c $(incdir)/compat.h $(top_builddir)/config.h
 strlcat.lo: $(compat)/strlcat.c $(incdir)/compat.h $(top_builddir)/config.h
 strlcpy.lo: $(compat)/strlcpy.c $(incdir)/compat.h $(top_builddir)/config.h
diff --git a/compat/strdup.c b/compat/strdup.c
deleted file mode 100644 (file)
index 17e11f9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif /* STDC_HEADERS */
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# ifdef HAVE_STRINGS_H
-#  include <strings.h>
-# endif
-#endif /* HAVE_STRING_H */
-#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS)
-# include <malloc.h>
-#endif /* HAVE_MALLOC_H && !STDC_HEADERS */
-
-#include <compat.h>
-
-char *
-strdup(const char *src)
-{
-    char *dst = NULL;
-    size_t len = strlen(src);
-
-    dst = (char *) malloc(len + 1);
-    (void) memcpy(dst, src, len);
-    dst[len] = '\0';
-
-    return dst;
-}
diff --git a/compat/strndup.c b/compat/strndup.c
deleted file mode 100644 (file)
index d6a905d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2010 Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif /* STDC_HEADERS */
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# ifdef HAVE_STRINGS_H
-#  include <strings.h>
-# endif
-#endif /* HAVE_STRING_H */
-#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS)
-# include <malloc.h>
-#endif /* HAVE_MALLOC_H && !STDC_HEADERS */
-
-#include <compat.h>
-
-char *
-strndup(const char *src, size_t maxlen)
-{
-    char *dst = NULL;
-    size_t len = strlen(src);
-
-    if (len > maxlen)
-       len = maxlen;
-    dst = (char *) malloc(len + 1);
-    (void) memcpy(dst, src, len);
-    dst[len] = '\0';
-
-    return dst;
-}
-