diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Makefile.am | 9 | ||||
-rw-r--r-- | src/common/extstr.c | 14 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 1a8f8c4..53d3627 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,5 +1,5 @@ -noinst_LTLIBRARIES = libcommon.la +noinst_LTLIBRARIES = libcommon4.la # libcommon.la libcommon_la_SOURCES = \ alloc.h alloc.c \ @@ -51,6 +51,13 @@ libcommon_la_CFLAGS += $(LIBCURL_CFLAGS) endif + +libcommon4_la_SOURCES = \ + extstr.h extstr.c + +libcommon4_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) + + devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libcommon_la_SOURCES:%c=) diff --git a/src/common/extstr.c b/src/common/extstr.c index ac93f5d..bd3491f 100644 --- a/src/common/extstr.c +++ b/src/common/extstr.c @@ -55,7 +55,7 @@ char *stradd(char *str1, const char *str2) else { - result = (char *)realloc(str1, (strlen(str1) + strlen(str2) + 1) * sizeof(char)); + result = realloc(str1, (strlen(str1) + strlen(str2) + 1) * sizeof(char)); strcat(result, str2); } @@ -87,7 +87,7 @@ char *strnadd(char *str1, const char *str2, size_t n) else { - result = (char *)realloc(str1, (strlen(str1) + n + 1) * sizeof(char)); + result = realloc(str1, (strlen(str1) + n + 1) * sizeof(char)); strncat(result, str2, n); } @@ -155,7 +155,7 @@ char *strprep(char *str1, const char *str2) char *result; /* Chaîne à renvoyer */ size_t len2; /* Taille de la seconde chaîne */ - result = (char *)realloc(str1, (strlen(str1) + strlen(str2) + 1) * sizeof(char)); + result = realloc(str1, (strlen(str1) + strlen(str2) + 1) * sizeof(char)); len2 = strlen(str2); @@ -261,7 +261,7 @@ char *strrpl(char *haystack, const char *needle1, const char *needle2) { inlen += (len2 - len1); - haystack = (char *)realloc(haystack, inlen * sizeof(char *)); + haystack = realloc(haystack, inlen * sizeof(char *)); found = haystack + index; memmove(found + len2, found + len1, inlen - len2 - index); @@ -274,7 +274,7 @@ char *strrpl(char *haystack, const char *needle1, const char *needle2) inlen -= (len1 - len2); - haystack = (char *)realloc(haystack, inlen * sizeof(char *)); + haystack = realloc(haystack, inlen * sizeof(char *)); found = haystack + index; } @@ -390,7 +390,7 @@ char **strtoka(const char *str, const char *delim, size_t *count) for (word = strtok(tmp, delim); word != NULL; word = strtok(NULL, delim)) { - result = (char **)realloc(result, ++(*count) * sizeof(char *)); + result = realloc(result, ++(*count) * sizeof(char *)); result[*count - 1] = strdup(word); } @@ -428,7 +428,7 @@ char *escape_crlf(char *input) for (curpos = 0; regexec(&preg, &input[curpos], 2, pmatch, 0) != REG_NOMATCH; ) { inlen += 1 + 1; - input = (char *)realloc(input, inlen * sizeof(char *)); + input = realloc(input, inlen * sizeof(char *)); memmove(&input[curpos + pmatch[1].rm_eo + 1], &input[curpos + pmatch[1].rm_eo], inlen - 1 - curpos - pmatch[1].rm_eo); |