X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Futils_subst.c;h=28924e449f37564e2cf8a2b2074cbf992be8ef78;hb=7c9d772c992647fcba64a96800c146eb9f1647f8;hp=523534324649ea0f807fcf3208219e1ac723b12b;hpb=c88c2de1c9cd6795b30c34990a565d18b69221e7;p=collectd.git diff --git a/src/daemon/utils_subst.c b/src/daemon/utils_subst.c index 52353432..28924e44 100644 --- a/src/daemon/utils_subst.c +++ b/src/daemon/utils_subst.c @@ -90,28 +90,6 @@ char *subst(char *buf, size_t buflen, const char *string, size_t off1, return buf; } /* subst */ -char *asubst(const char *string, int off1, int off2, const char *replacement) { - char *buf; - int len; - - char *ret; - - if ((NULL == string) || (0 > off1) || (0 > off2) || (off1 > off2) || - (NULL == replacement)) - return NULL; - - len = off1 + strlen(replacement) + strlen(string) - off2 + 1; - - buf = malloc(len); - if (NULL == buf) - return NULL; - - ret = subst(buf, len, string, off1, off2, replacement); - if (NULL == ret) - free(buf); - return ret; -} /* asubst */ - char *subst_string(char *buf, size_t buflen, const char *string, const char *needle, const char *replacement) { size_t needle_len; @@ -119,7 +97,7 @@ char *subst_string(char *buf, size_t buflen, const char *string, if ((buf == NULL) || (string == NULL) || (needle == NULL) || (replacement == NULL)) - return (NULL); + return NULL; needle_len = strlen(needle); sstrncpy(buf, string, buflen); @@ -152,10 +130,10 @@ char *subst_string(char *buf, size_t buflen, const char *string, } if (i >= buflen) { - WARNING("subst_string: Loop exited after %zu iterations: " + WARNING("subst_string: Loop exited after %" PRIsz " iterations: " "string = %s; needle = %s; replacement = %s;", i, string, needle, replacement); } - return (buf); + return buf; } /* char *subst_string */