assert (plugin != NULL);
assert (type != NULL);
+ if (prefix == NULL)
+ prefix = "";
+
+ if (postfix == NULL)
+ postfix = "";
+
if ((n_hostname = malloc(strlen(hostname)+1)) == NULL)
{
ERROR ("Unable to allocate memory for normalized hostname buffer");
}
}
- if (cb->prefix == NULL) {
- if ((cb->prefix = malloc((int)sizeof(char))) == NULL)
- {
- ERROR ("Unable to allocate memory for hostname prefix buffer");
- return (-1);
- }
- cb->prefix[0] = '\0';
- }
-
- if (cb->postfix == NULL) {
- if ((cb->postfix = malloc((int)sizeof(char))) == NULL)
- {
- ERROR ("Unable to allocate memory for hostname postfix buffer");
- return (-1);
- }
- cb->postfix[0] = '\0';
- }
-
DEBUG ("write_graphite: Registering write callback to carbon agent %s:%s",
cb->node ? cb->node : WG_DEFAULT_NODE,
cb->service ? cb->service : WG_DEFAULT_SERVICE);