#include "collectd.h"
-#include "common.h"
+#include "utils/common/common.h"
#include "utils_subst.h"
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;
}
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);
}