projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
comet2monitorのダンプ時に範囲が指定できるように
[YACASL2.git]
/
src
/
cmem.c
diff --git
a/src/cmem.c
b/src/cmem.c
index
4e24586
..
ef7a9dd
100644
(file)
--- a/
src/cmem.c
+++ b/
src/cmem.c
@@
-31,3
+31,14
@@
char *strdup_chk(const char *s, char *tag)
strcpy(t, s);
return t;
}
+
+char *strndup_chk(const char *s, size_t len, char *tag)
+{
+ assert(s != NULL);
+ char *t;
+
+ t = malloc_chk(len + 1, tag);
+ strncpy(t, s, len);
+ t[len] = '\0';
+ return t;
+}