poldek: trurlib/include/trurl/nmalloc.h - +n_strdupapl()
mis
mis at pld-linux.org
Mon Jul 2 23:58:49 CEST 2007
Author: mis Date: Mon Jul 2 21:58:49 2007 GMT
Module: poldek Tag: HEAD
---- Log message:
- +n_strdupapl()
---- Files affected:
poldek/trurlib/include/trurl:
nmalloc.h (1.7 -> 1.8)
---- Diffs:
================================================================
Index: poldek/trurlib/include/trurl/nmalloc.h
diff -u poldek/trurlib/include/trurl/nmalloc.h:1.7 poldek/trurlib/include/trurl/nmalloc.h:1.8
--- poldek/trurlib/include/trurl/nmalloc.h:1.7 Fri Jul 9 19:26:04 2004
+++ poldek/trurlib/include/trurl/nmalloc.h Mon Jul 2 23:58:44 2007
@@ -22,7 +22,7 @@
void *n_memdup(const void *ptr, size_t size);
-/* call it n_strdupap(src, &dest) */
+/* strdup && alloca; call it n_strdupap(src, &dest) */
#define n_strdupap(s, dp) \
do { \
const char *ss = (s); \
@@ -30,6 +30,14 @@
int len = strlen(ss) + 1; \
*dptr = alloca(len); \
memcpy(*dptr, ss, len); \
+ } while (0);
+
+#define n_strdupapl(s, length, dp) \
+ do { \
+ const char *ss = (s); \
+ char **dptr = (dp); \
+ *dptr = alloca(length + 1); \
+ memcpy(*dptr, ss, length + 1); \
} while (0);
================================================================
---- CVS-web:
http://cvs.pld-linux.org/poldek/trurlib/include/trurl/nmalloc.h?r1=1.7&r2=1.8&f=u
More information about the pld-cvs-commit
mailing list