123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include "private.h"
- #include <string.h>
- #include <stdlib.h>
- void
- lub_string_catn(char **string,
- const char *text,
- size_t len)
- {
- if(text)
- {
- char *q;
- size_t length,initlen,textlen = strlen(text);
-
- len = (len < textlen) ? len : textlen;
-
-
- initlen = *string ? strlen(*string) : 0;
-
-
- length = initlen + len + 1;
-
- q = realloc(*string,length);
- if(NULL != q)
- {
- *string = q;
-
- q += initlen;
- while(len--)
- {
- *q++ = *text++;
- }
- *q = '\0';
- }
- }
- }
|