-static char *correct_strndup(const char *src, size_t n) {
- char *ret;
- size_t len = strlen(src);
-
- if (n < len)
- len = n;
-
- if (!(ret = (char*)mem_a(len + 1)))
- return NULL;
-
- ret[len] = '\0';
- return (char*)memcpy(ret, src, len);
-}
-
-static char *correct_concat(char *str1, char *str2, bool next) {
- char *ret = NULL;
-
-#if 0
- if (!str1) {
- str1 = mem_a(1);
- *str1 = '\0';
- }
-#endif
-
- str1 = mem_r (str1, strlen(str1) + strlen(str2) + 1);
- ret = strcat(str1, str2);
-
- if (str2 && next)
- mem_d(str2);
-
- return ret;
-}
-