# HG changeset patch # User tuomov # Date 1078693848 -3600 # Node ID 5b732dd506d3fd2748abb02abcf2696eb252c9c4 # Parent aae5facf9fc5c945cdaefcf75e0e2b89ebe4d632 trunk: changeset 1360 Added scopyn. diff -r aae5facf9fc5 -r 5b732dd506d3 misc.c --- a/misc.c Mon Feb 16 18:50:28 2004 +0100 +++ b/misc.c Sun Mar 07 22:10:48 2004 +0100 @@ -43,12 +43,9 @@ } -char *scopy(const char *p) +char *scopyn(const char *p, size_t l) { - char*pn; - size_t l=strlen(p); - - pn=(char*)malloc(l+1); + char *pn=(char*)malloc(l+1); if(pn==NULL) return NULL; @@ -57,6 +54,13 @@ return pn; } + + +char *scopy(const char *p) +{ + size_t l=strlen(p); + return scopyn(p, l); +} char *scat(const char *p1, const char *p2) diff -r aae5facf9fc5 -r 5b732dd506d3 misc.h --- a/misc.h Mon Feb 16 18:50:28 2004 +0100 +++ b/misc.h Sun Mar 07 22:10:48 2004 +0100 @@ -28,6 +28,7 @@ extern void* remalloczero(void *ptr, size_t oldsize, size_t newsize); extern char* scopy(const char *p); +extern char* scopyn(const char *p, size_t n); extern char* scat(const char *p1, const char *p2); extern char* scatn(const char *p1, ssize_t n1, const char *p2, ssize_t n2); extern char* scat3(const char *p1, const char *p2, const char *p3);