]> git.sur5r.net Git - i3/i3/blobdiff - libi3/safewrappers.c
Merge pull request #1805 from lasers/next
[i3/i3] / libi3 / safewrappers.c
index db9b6b4a42efbf287e06466295ad0e2d2e30e2e5..f5973cab982185f869d0ed6b39eaf0ea80b67235 100644 (file)
@@ -2,7 +2,7 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  */
 #include <string.h>
@@ -48,6 +48,13 @@ char *sstrdup(const char *str) {
     return result;
 }
 
+char *sstrndup(const char *str, size_t size) {
+    char *result = strndup(str, size);
+    if (result == NULL)
+        err(EXIT_FAILURE, "strndup()");
+    return result;
+}
+
 int sasprintf(char **strp, const char *fmt, ...) {
     va_list args;
     int result;