- strlcat (buffer, "{\"host\":\"", sizeof (buffer));
- strlcat (buffer, ident->host, sizeof (buffer));
- strlcat (buffer, "\",\"plugin\":\"", sizeof (buffer));
- strlcat (buffer, ident->plugin, sizeof (buffer));
- strlcat (buffer, "\",\"plugin_instance\":\"", sizeof (buffer));
- strlcat (buffer, ident->plugin_instance, sizeof (buffer));
- strlcat (buffer, "\",\"type\":\"", sizeof (buffer));
- strlcat (buffer, ident->type, sizeof (buffer));
- strlcat (buffer, "\",\"type_instance\":\"", sizeof (buffer));
- strlcat (buffer, ident->type_instance, sizeof (buffer));
- strlcat (buffer, "\"}", sizeof (buffer));
+#define ADD_STRING(str) do { \
+ status = yajl_gen_string (handler, \
+ (unsigned char *) (str), \
+ (unsigned int) strlen (str)); \
+ if (status != yajl_gen_status_ok) \
+ return ((int) status); \
+} while (0)