aboutsummaryrefslogtreecommitdiffstats
path: root/src/string_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/string_utils.c')
-rw-r--r--src/string_utils.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/string_utils.c b/src/string_utils.c
new file mode 100644
index 0000000..dcabcac
--- /dev/null
+++ b/src/string_utils.c
@@ -0,0 +1,16 @@
+// Copyright 2007-2022 David Robillard <d@drobilla.net>
+// SPDX-License-Identifier: ISC
+
+#include "string_utils.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+char*
+jalv_strdup(const char* const str)
+{
+ const size_t len = strlen(str);
+ char* copy = (char*)malloc(len + 1);
+ memcpy(copy, str, len + 1);
+ return copy;
+}