summaryrefslogtreecommitdiffstats
path: root/common/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/mem.c')
-rw-r--r--common/mem.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/mem.c b/common/mem.c
index ec274bb3..ffb2fa45 100644
--- a/common/mem.c
+++ b/common/mem.c
@@ -28,6 +28,18 @@
}
#endif
+size_t spice_strnlen(const char *str, size_t max_len)
+{
+ size_t len = 0;
+
+ while (len < max_len && *str != 0) {
+ len++;
+ str++;
+ }
+
+ return len;
+}
+
char *spice_strdup(const char *str)
{
char *copy;