aboutsummaryrefslogtreecommitdiff
path: root/src/shared/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/helpers.h')
-rw-r--r--src/shared/helpers.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/helpers.h b/src/shared/helpers.h
index dee41b75..36a25a2d 100644
--- a/src/shared/helpers.h
+++ b/src/shared/helpers.h
@@ -91,6 +91,22 @@ RC_UNUSED static char *xstrdup(const char *str)
/* NOTREACHED */
}
+RC_UNUSED static char *xstrndup(const char *str, size_t n)
+{
+ char *value;
+
+ if (!str)
+ return (NULL);
+
+ value = strndup(str, n);
+
+ if (value)
+ return (value);
+
+ ERRX;
+ /* NOTREACHED */
+}
+
#undef ERRX
/*