-#define REPLACE_FIELD(t, v) \
- if (subst_string (temp, sizeof (temp), dest, t, v) != NULL) \
- sstrncpy (dest, temp, size);
- REPLACE_FIELD ("%{host}", vl->host);
- REPLACE_FIELD ("%{plugin}", vl->plugin);
- REPLACE_FIELD ("%{plugin_instance}", vl->plugin_instance);
- REPLACE_FIELD ("%{type}", vl->type);
- REPLACE_FIELD ("%{type_instance}", vl->type_instance);
-
- if (vl->meta != NULL)
- {
- char **meta_toc;
- int meta_entries = meta_data_toc (vl->meta, &meta_toc);
- for (int i = 0; i < meta_entries; i++)
- {
+#define REPLACE_FIELD(t, v) \
+ if (subst_string(temp, sizeof(temp), dest, t, v) != NULL) \
+ sstrncpy(dest, temp, size);
+ REPLACE_FIELD("%{host}", vl->host);
+ REPLACE_FIELD("%{plugin}", vl->plugin);
+ REPLACE_FIELD("%{plugin_instance}", vl->plugin_instance);
+ REPLACE_FIELD("%{type}", vl->type);
+ REPLACE_FIELD("%{type_instance}", vl->type_instance);
+
+ if (vl->meta != NULL) {
+ char **meta_toc = NULL;
+ int meta_entries = meta_data_toc(vl->meta, &meta_toc);
+ if (meta_entries <= 0)
+ return;
+
+ for (int i = 0; i < meta_entries; i++) {