summaryrefslogtreecommitdiff
path: root/src/include/xml/encode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/xml/encode.c')
-rw-r--r--src/include/xml/encode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/include/xml/encode.c b/src/include/xml/encode.c
index 60e418d..6ed753e 100644
--- a/src/include/xml/encode.c
+++ b/src/include/xml/encode.c
@@ -5,8 +5,11 @@
#include "xml.h"
static void check(char **str, int *len, int *used, int n);
+static char *encode_helper(map_t *map, int len);
-char *encode(map_t *map, int len) {
+char *encode(map_t *map) { return encode_helper(map, 1); }
+
+static char *encode_helper(map_t *map, int len) {
int slen = 128, used = 0;
char *str = calloc(slen, sizeof(char));
@@ -25,7 +28,7 @@ char *encode(map_t *map, int len) {
check(&str, &slen, &used, 1);
strcat(str, ">");
if (map[i].size == sizeof(map_t)) {
- char *rt = encode((map_t *)map[i].payload, map[i].n);
+ char *rt = encode_helper((map_t *)map[i].payload, map[i].n);
if (rt == NULL)
return NULL;
check(&str, &slen, &used, strlen(rt));