aboutsummaryrefslogtreecommitdiff
path: root/macos/compat/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'macos/compat/strdup.c')
-rw-r--r--macos/compat/strdup.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/macos/compat/strdup.c b/macos/compat/strdup.c
new file mode 100644
index 0000000..294e2d0
--- /dev/null
+++ b/macos/compat/strdup.c
@@ -0,0 +1,21 @@
+#include <ogg/os_types.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
+
+char *strdup(const char *inStr)
+{
+ char *outStr = NULL;
+
+ if (inStr == NULL) {
+ return NULL;
+ }
+
+ outStr = _ogg_malloc(strlen(inStr) + 1);
+
+ if (outStr != NULL) {
+ strcpy(outStr, inStr);
+ }
+
+ return outStr;
+}