Move repeated #defines into tr_json_util.h and add documentation
[trust_router.git] / trp / trp_route_encoders.c
index c954a81..7cbb3ac 100644 (file)
@@ -44,6 +44,7 @@
 #include <trp_rtable.h>
 #include <trust_router/trp.h>
 #include <tr_util.h>
+#include <tr_json_util.h>
 
 /* Pretty print a route table entry to a newly allocated string. If sep is NULL,
  * returns comma+space separated string. */
@@ -103,21 +104,6 @@ static json_t *expiry_to_json_string(TRP_ROUTE *route)
   return jstr;
 }
 
-/* helper for below */
-#define OBJECT_SET_OR_FAIL(jobj, key, val)     \
-do {                                           \
-  if (val)                                     \
-    json_object_set_new((jobj),(key),(val));   \
-  else                                         \
-    goto cleanup;                              \
-} while (0)
-
-#define OBJECT_SET_OR_SKIP(jobj, key, val)     \
-do {                                           \
-  if (val)                                     \
-    json_object_set_new((jobj),(key),(val));   \
-} while (0)
-
 json_t *trp_route_to_json(TRP_ROUTE *route)
 {
   json_t *route_json = NULL;