aboutsummaryrefslogtreecommitdiffstats
path: root/src/string/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string/strdup.c')
-rw-r--r--src/string/strdup.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/string/strdup.c b/src/string/strdup.c
index 6a66c2c..b7155d7 100644
--- a/src/string/strdup.c
+++ b/src/string/strdup.c
@@ -36,44 +36,3 @@ char* strdup(const char* string)
return r == NULL ? NULL : memcpy(r, string, n * sizeof(char));
}
-
-/**
- * Duplicate a string.
- *
- * This is a GNU extension.
- *
- * @param string The string to duplicate.
- * @param maxlen Truncate the string to this length, if it is longer.
- * A NUL byte is guaranteed to always be written
- * upon successful completion.
- * @return The new string. `NULL` is returned on error
- * and `errno` is set to indicate the error.
- *
- * @throws ENOMEM The process could not allocate sufficient amount of memory.
- */
-char* strndup(const char* string, size_t maxlen)
-{
- size_t n = strnlen(string, maxlen) + 1;
- char* r = malloc(n * sizeof(char));
- return r == NULL ? NULL : memcpy(r, string, n * sizeof(char));
-}
-
-
-/**
- * Duplicate a memory segment.
- *
- * This is a slibc extension.
- *
- * @param segment The memory segment to duplicate.
- * @param size The size of the memory segment.
- * @return The new segment. `NULL` is returned on error
- * and `errno` is set to indicate the error.
- *
- * @throws ENOMEM The process could not allocate sufficient amount of memory.
- */
-void* memdup(const void* segment, size_t size)
-{
- void* r = malloc(size);
- return r == NULL ? NULL : memcpy(r, segment, size);
-}
-