diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2021-07-24 22:05:46 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2021-07-24 22:06:04 +0200 |
commit | 31eae6bbe16302d2593b806ef3d2ac2ca9c2d8de (patch) | |
tree | eba886ebfd704f83f13ce1b50976e3bdca6b2449 /src/json/json_helper.c | |
parent | ebd034f8139ee90336fd8e7e2f24f9c9d39c5e25 (diff) | |
download | gnunet-31eae6bbe16302d2593b806ef3d2ac2ca9c2d8de.tar.gz gnunet-31eae6bbe16302d2593b806ef3d2ac2ca9c2d8de.zip |
early draft for libgnunetpq event notification support
Diffstat (limited to 'src/json/json_helper.c')
-rw-r--r-- | src/json/json_helper.c | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 03db9ec80..55435ea19 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c | |||
@@ -116,7 +116,6 @@ parse_variable_data (void *cls, | |||
116 | const char *str; | 116 | const char *str; |
117 | size_t size; | 117 | size_t size; |
118 | void *data; | 118 | void *data; |
119 | int res; | ||
120 | 119 | ||
121 | str = json_string_value (root); | 120 | str = json_string_value (root); |
122 | if (NULL == str) | 121 | if (NULL == str) |
@@ -124,30 +123,13 @@ parse_variable_data (void *cls, | |||
124 | GNUNET_break_op (0); | 123 | GNUNET_break_op (0); |
125 | return GNUNET_SYSERR; | 124 | return GNUNET_SYSERR; |
126 | } | 125 | } |
127 | size = (strlen (str) * 5) / 8; | 126 | if (GNUNET_OK != |
128 | if (size >= GNUNET_MAX_MALLOC_CHECKED) | 127 | GNUNET_STRINGS_string_to_data_alloc (str, |
129 | { | 128 | strlen (str), |
130 | GNUNET_break_op (0); | 129 | &data, |
131 | return GNUNET_SYSERR; | 130 | &size)) |
132 | } | ||
133 | data = GNUNET_malloc (size); | ||
134 | res = GNUNET_STRINGS_string_to_data (str, | ||
135 | strlen (str), | ||
136 | data, | ||
137 | size); | ||
138 | if ( (0 < size) && | ||
139 | (GNUNET_OK != res) ) | ||
140 | { | ||
141 | size--; | ||
142 | res = GNUNET_STRINGS_string_to_data (str, | ||
143 | strlen (str), | ||
144 | data, | ||
145 | size); | ||
146 | } | ||
147 | if (GNUNET_OK != res) | ||
148 | { | 131 | { |
149 | GNUNET_break_op (0); | 132 | GNUNET_break_op (0); |
150 | GNUNET_free (data); | ||
151 | return GNUNET_SYSERR; | 133 | return GNUNET_SYSERR; |
152 | } | 134 | } |
153 | *(void **) spec->ptr = data; | 135 | *(void **) spec->ptr = data; |