aboutsummaryrefslogtreecommitdiff
path: root/src/util/configuration.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r--src/util/configuration.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index a1150aa9b..1b600b4c8 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -183,7 +183,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
183 if (NULL == pos) 183 if (NULL == pos)
184 { 184 {
185 line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read); 185 line_orig = GNUNET_strndup (&mem[r_bytes], line_size = to_read);
186 r_bytes += line_size; 186 r_bytes += line_size;
187 } 187 }
188 else 188 else
189 { 189 {
@@ -220,10 +220,10 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
220 continue; 220 continue;
221 221
222 /* handle special "@INLINE@" directive */ 222 /* handle special "@INLINE@" directive */
223 if (0 == strncasecmp (line, 223 if (0 == strncasecmp (line,
224 "@INLINE@ ", 224 "@INLINE@ ",
225 strlen ("@INLINE@ "))) 225 strlen ("@INLINE@ ")))
226 { 226 {
227 /* @INLINE@ value */ 227 /* @INLINE@ value */
228 value = &line[strlen ("@INLINE@ ")]; 228 value = &line[strlen ("@INLINE@ ")];
229 if (GNUNET_YES == allow_inline) 229 if (GNUNET_YES == allow_inline)
@@ -250,19 +250,19 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
250 value = &line[1]; 250 value = &line[1];
251 GNUNET_free (section); 251 GNUNET_free (section);
252 section = GNUNET_strdup (value); 252 section = GNUNET_strdup (value);
253 LOG (GNUNET_ERROR_TYPE_DEBUG, 253 LOG (GNUNET_ERROR_TYPE_DEBUG,
254 "Config section `%s'\n", 254 "Config section `%s'\n",
255 section); 255 section);
256 continue; 256 continue;
257 } 257 }
258 if (NULL != (eq = strchr (line, '='))) 258 if (NULL != (eq = strchr (line, '=')))
259 { 259 {
260 /* tag = value */ 260 /* tag = value */
261 tag = GNUNET_strndup (line, eq - line); 261 tag = GNUNET_strndup (line, eq - line);
262 /* remove tailing whitespace */ 262 /* remove tailing whitespace */
263 for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--) 263 for (i = strlen (tag) - 1; (i >= 1) && (isspace ((unsigned char) tag[i]));i--)
264 tag[i] = '\0'; 264 tag[i] = '\0';
265 265
266 /* Strip whitespace */ 266 /* Strip whitespace */
267 value = eq + 1; 267 value = eq + 1;
268 while (isspace ((unsigned char) value[0])) 268 while (isspace ((unsigned char) value[0]))
@@ -285,14 +285,14 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
285 } 285 }
286 /* parse error */ 286 /* parse error */
287 LOG (GNUNET_ERROR_TYPE_WARNING, 287 LOG (GNUNET_ERROR_TYPE_WARNING,
288 _("Syntax error while deserializing in line %u\n"), 288 _("Syntax error while deserializing in line %u\n"),
289 nr); 289 nr);
290 ret = GNUNET_SYSERR; 290 ret = GNUNET_SYSERR;
291 break; 291 break;
292 } 292 }
293 LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n"); 293 LOG (GNUNET_ERROR_TYPE_DEBUG, "Finished deserializing config\n");
294 GNUNET_free_non_null (line_orig); 294 GNUNET_free_non_null (line_orig);
295 GNUNET_free (section); 295 GNUNET_free (section);
296 GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) ); 296 GNUNET_assert ( (GNUNET_OK != ret) || (r_bytes == size) );
297 return ret; 297 return ret;
298} 298}
@@ -323,7 +323,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
323 if (fn == NULL) 323 if (fn == NULL)
324 return GNUNET_SYSERR; 324 return GNUNET_SYSERR;
325 dirty = cfg->dirty; /* back up value! */ 325 dirty = cfg->dirty; /* back up value! */
326 if (GNUNET_SYSERR == 326 if (GNUNET_SYSERR ==
327 GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES)) 327 GNUNET_DISK_file_size (fn, &fs64, GNUNET_YES, GNUNET_YES))
328 { 328 {
329 LOG (GNUNET_ERROR_TYPE_WARNING, 329 LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -349,7 +349,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
349 } 349 }
350 LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn); 350 LOG (GNUNET_ERROR_TYPE_DEBUG, "Deserializing contents of file `%s'\n", fn);
351 GNUNET_free (fn); 351 GNUNET_free (fn);
352 ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES); 352 ret = GNUNET_CONFIGURATION_deserialize (cfg, mem, fs, GNUNET_YES);
353 GNUNET_free (mem); 353 GNUNET_free (mem);
354 /* restore dirty flag - anything we set in the meantime 354 /* restore dirty flag - anything we set in the meantime
355 * came from disk */ 355 * came from disk */
@@ -425,7 +425,7 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
425 mem = GNUNET_malloc (m_size); 425 mem = GNUNET_malloc (m_size);
426 sec = cfg->sections; 426 sec = cfg->sections;
427 c_size = 0; 427 c_size = 0;
428 *size = c_size; 428 *size = c_size;
429 while (NULL != sec) 429 while (NULL != sec)
430 { 430 {
431 len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name); 431 len = GNUNET_asprintf (&cbuf, "[%s]\n", sec->name);
@@ -487,9 +487,9 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
487 } 487 }
488 cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size); 488 cfg_buf = GNUNET_CONFIGURATION_serialize (cfg, &size);
489 if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size, 489 if (size != GNUNET_DISK_fn_write (fn, cfg_buf, size,
490 GNUNET_DISK_PERM_USER_READ 490 GNUNET_DISK_PERM_USER_READ
491 | GNUNET_DISK_PERM_USER_WRITE 491 | GNUNET_DISK_PERM_USER_WRITE
492 | GNUNET_DISK_PERM_GROUP_READ 492 | GNUNET_DISK_PERM_GROUP_READ
493 | GNUNET_DISK_PERM_GROUP_WRITE)) 493 | GNUNET_DISK_PERM_GROUP_WRITE))
494 { 494 {
495 GNUNET_free (fn); 495 GNUNET_free (fn);
@@ -1090,7 +1090,7 @@ GNUNET_CONFIGURATION_get_value_filename (const struct
1090 const char *option, char **value) 1090 const char *option, char **value)
1091{ 1091{
1092 char *tmp; 1092 char *tmp;
1093 1093
1094 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section); 1094 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asked to retrieve filename `%s' in section `%s'\n", option, section);
1095 if (GNUNET_OK != 1095 if (GNUNET_OK !=
1096 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp)) 1096 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &tmp))