rottenbytes/collectd — comment on commit 69e0e4a44308ef271e2ac73452f632c274646fd9
File: src/memcached.c line 393
By octo:

This will break backwards-compatibility for users who did not change their configuration. This is a hard requirement if this change is to be applied to the *collectd-5* branch. I suggest the following approach (pseudo-code!):

```C
static int config_add_syntax (oconfig_item_t *ci)
{
if (strcasecmp ("Plugin", ci->key) == 0) /* backwards compatibility code without instance block */
st->name = strdup ("default");
else
cf_util_get_string (ci, &st->name);

for (child in ci->children)
{
if (strcasecmp ("Instance", child->key) == 0)
continue; /* Ignore "Instance" blocks here, they're handled in config() below. */
else
...;
}
}

static int config (oconfig_item_t *ci)
{
_Bool have_legacy_config = 1;
for (child in ci->children)
{
if (strcasecmp ("Instance", child->key) == 0)
{
have_legacy_config = 0;
config_add_instance (child);
}
}
if (have_legacy_config)
config_add_instance (ci);
}