[rs-commit] r57 - /redwax-tool/trunk/redwax_util.c

rs-commit at redwax.eu rs-commit at redwax.eu
Tue Nov 23 13:55:29 CET 2021


Author: minfrin at redwax.eu
Date: Tue Nov 23 13:55:29 2021
New Revision: 57

Log:
Stop yaml dashes bleeding into xml and json.

Modified:
    redwax-tool/trunk/redwax_util.c

Modified: redwax-tool/trunk/redwax_util.c
==============================================================================
--- redwax-tool/trunk/redwax_util.c	(original)
+++ redwax-tool/trunk/redwax_util.c	Tue Nov 23 13:55:29 2021
@@ -1098,6 +1098,8 @@
 
     int empty = m->level->empty;
 
+    apr_status_t status = APR_SUCCESS;
+
     if (!ml->array) {
         return APR_EGENERAL;
     }
@@ -1107,8 +1109,6 @@
                 redwax_metadata_level_t);
     }
 
-    redwax_metadata_prefix(m, -1);
-
     switch (m->format) {
     case REDWAX_FORMAT_TEXT:
         break;
@@ -1116,7 +1116,7 @@
 
         if (empty) {
 
-            return APR_SUCCESS;
+            status = APR_SUCCESS;
         }
         else {
 
@@ -1128,7 +1128,7 @@
                     {">", 1},
             };
 
-            return m->wv(m->ctx, vec, 5);
+            status = m->wv(m->ctx, vec, 5);
         }
 
         break;
@@ -1141,7 +1141,7 @@
                     {"]", 1}
             };
 
-            return m->wv(m->ctx, vec, 1);
+            status = m->wv(m->ctx, vec, 1);
         }
         else {
 
@@ -1151,7 +1151,7 @@
                     {"]", 1}
             };
 
-            return m->wv(m->ctx, vec, 3);
+            status = m->wv(m->ctx, vec, 3);
         }
 
         break;
@@ -1160,7 +1160,9 @@
         break;
     }
 
-    return APR_SUCCESS;
+    redwax_metadata_prefix(m, -1);
+
+    return status;
 }
 
 apr_status_t redwax_metadata_push_object(redwax_metadata_t *m, const char *k, int empty)
@@ -1291,6 +1293,8 @@
 
     int empty = m->level->empty;
 
+    apr_status_t status = APR_SUCCESS;
+
     if (!ml->object) {
         return APR_EGENERAL;
     }
@@ -1300,8 +1304,6 @@
                 redwax_metadata_level_t);
     }
 
-    redwax_metadata_prefix(m, -1);
-
     switch (m->format) {
     case REDWAX_FORMAT_TEXT:
         break;
@@ -1309,7 +1311,7 @@
 
         if (empty) {
 
-            return APR_SUCCESS;
+            status = APR_SUCCESS;
         }
         else {
 
@@ -1321,7 +1323,7 @@
                     {">", 1},
             };
 
-            return m->wv(m->ctx, vec, 5);
+            status = m->wv(m->ctx, vec, 5);
         }
 
         break;
@@ -1334,7 +1336,7 @@
                     {"}", 1}
             };
 
-            return m->wv(m->ctx, vec, 1);
+            status = m->wv(m->ctx, vec, 1);
         }
         else {
 
@@ -1344,7 +1346,7 @@
                     {"}", 1}
             };
 
-            return m->wv(m->ctx, vec, 3);
+            status = m->wv(m->ctx, vec, 3);
         }
 
         break;
@@ -1353,7 +1355,9 @@
         break;
     }
 
-    return APR_SUCCESS;
+    redwax_metadata_prefix(m, -1);
+
+    return status;
 }
 
 apr_status_t redwax_metadata_add_string(redwax_metadata_t *m, const char *key, const char *val)



More information about the rs-commit mailing list