]> git.cworth.org Git - obsolete/notmuch-old/blobdiff - util/talloc-extra.c
Merge tag 'debian/0.15.1-1' into squeeze-backports
[obsolete/notmuch-old] / util / talloc-extra.c
diff --git a/util/talloc-extra.c b/util/talloc-extra.c
new file mode 100644 (file)
index 0000000..9626247
--- /dev/null
@@ -0,0 +1,14 @@
+#include <string.h>
+#include "talloc-extra.h"
+
+char *
+talloc_strndup_named_const (void *ctx, const char *str,
+                           size_t len, const char *name)
+{
+    char *ptr = talloc_strndup (ctx, str, len);
+
+    if (ptr)
+       talloc_set_name_const (ptr, name);
+
+    return ptr;
+}