diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-14 07:23:11 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-14 07:23:11 +0000 |
commit | a0b178aa52170a1f8f6582f8541f4c91be943154 (patch) | |
tree | 5e0c7f6adc8ddeb084a2ccfe93fa5ef454861853 | |
parent | 662b5736c37e8cf2b3e6aa5af53cef0d03b743ab (diff) | |
download | gnunet-a0b178aa52170a1f8f6582f8541f4c91be943154.tar.gz gnunet-a0b178aa52170a1f8f6582f8541f4c91be943154.zip |
LRN: Use GNUNET_strdup() instead of strdup()
-rw-r--r-- | src/dv/gnunet-service-dv.c | 2 | ||||
-rw-r--r-- | src/hostlist/hostlist-client.c | 4 | ||||
-rw-r--r-- | src/transport/gnunet-transport-connect-running-peers.c | 2 | ||||
-rw-r--r-- | src/transport/transport-testing.c | 6 | ||||
-rw-r--r-- | src/util/common_logging.c | 10 | ||||
-rw-r--r-- | src/util/os_installation.c | 2 |
6 files changed, 13 insertions, 13 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index e58fd70e4..44fa9dee5 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -1489,7 +1489,7 @@ handle_dv_data_message (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1489 | pos = dn->referee_head; | 1489 | pos = dn->referee_head; |
1490 | while ((NULL != pos) && (pos->referrer_id != sid)) | 1490 | while ((NULL != pos) && (pos->referrer_id != sid)) |
1491 | { | 1491 | { |
1492 | sender_id = strdup (GNUNET_i2s (&pos->identity)); | 1492 | sender_id = GNUNET_strdup (GNUNET_i2s (&pos->identity)); |
1493 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I know sender %u %s\n", | 1493 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I know sender %u %s\n", |
1494 | pos->referrer_id, sender_id); | 1494 | pos->referrer_id, sender_id); |
1495 | GNUNET_free (sender_id); | 1495 | GNUNET_free (sender_id); |
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 3343b7a49..1cc5836af 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c | |||
@@ -443,7 +443,7 @@ download_get_url () | |||
443 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 443 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
444 | "Testing new advertised hostlist if it is obtainable\n"); | 444 | "Testing new advertised hostlist if it is obtainable\n"); |
445 | current_hostlist = hostlist_to_test; | 445 | current_hostlist = hostlist_to_test; |
446 | return strdup (hostlist_to_test->hostlist_uri); | 446 | return GNUNET_strdup (hostlist_to_test->hostlist_uri); |
447 | } | 447 | } |
448 | 448 | ||
449 | if ((GNUNET_YES == stat_use_bootstrap) || (linked_list_size == 0)) | 449 | if ((GNUNET_YES == stat_use_bootstrap) || (linked_list_size == 0)) |
@@ -465,7 +465,7 @@ download_get_url () | |||
465 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using learned hostlist `%s'\n", | 465 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using learned hostlist `%s'\n", |
466 | pos->hostlist_uri); | 466 | pos->hostlist_uri); |
467 | current_hostlist = pos; | 467 | current_hostlist = pos; |
468 | return strdup (pos->hostlist_uri); | 468 | return GNUNET_strdup (pos->hostlist_uri); |
469 | } | 469 | } |
470 | 470 | ||
471 | 471 | ||
diff --git a/src/transport/gnunet-transport-connect-running-peers.c b/src/transport/gnunet-transport-connect-running-peers.c index 9b60ba176..131961c23 100644 --- a/src/transport/gnunet-transport-connect-running-peers.c +++ b/src/transport/gnunet-transport-connect-running-peers.c | |||
@@ -290,7 +290,7 @@ static void | |||
290 | testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) | 290 | testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) |
291 | { | 291 | { |
292 | cc = NULL; | 292 | cc = NULL; |
293 | char *p1_c = strdup (GNUNET_i2s (&p1->id)); | 293 | char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); |
294 | 294 | ||
295 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers connected: %s <-> %s\n", p1_c, | 295 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers connected: %s <-> %s\n", p1_c, |
296 | GNUNET_i2s (&p2->id)); | 296 | GNUNET_i2s (&p2->id)); |
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 76d88ab84..2e0ca1e55 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -219,7 +219,7 @@ try_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
219 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 219 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | char * p2_s = strdup(GNUNET_i2s (&p2->id)); | 222 | char * p2_s = GNUNET_strdup(GNUNET_i2s (&p2->id)); |
223 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", | 223 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", |
224 | "Asking peers %u (`%s') to connect peer %u (`%s')\n", | 224 | "Asking peers %u (`%s') to connect peer %u (`%s')\n", |
225 | p1->no, GNUNET_i2s (&p1->id), p2->no, p2_s); | 225 | p1->no, GNUNET_i2s (&p1->id), p2->no, p2_s); |
@@ -481,7 +481,7 @@ GNUNET_TRANSPORT_TESTING_init () | |||
481 | char * | 481 | char * |
482 | extract_filename (const char *file) | 482 | extract_filename (const char *file) |
483 | { | 483 | { |
484 | char *pch = strdup (file); | 484 | char *pch = GNUNET_strdup (file); |
485 | char *backup = pch; | 485 | char *backup = pch; |
486 | char *filename = NULL; | 486 | char *filename = NULL; |
487 | char *res; | 487 | char *res; |
@@ -501,7 +501,7 @@ extract_filename (const char *file) | |||
501 | else | 501 | else |
502 | filename = pch; | 502 | filename = pch; |
503 | 503 | ||
504 | res = strdup (filename); | 504 | res = GNUNET_strdup (filename); |
505 | GNUNET_free (backup); | 505 | GNUNET_free (backup); |
506 | return res; | 506 | return res; |
507 | } | 507 | } |
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 503fb671d..1d3843cfd 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -283,16 +283,16 @@ add_definition (char *component, char *file, char *function, int from_line, | |||
283 | struct LogDef n; | 283 | struct LogDef n; |
284 | memset (&n, 0, sizeof (n)); | 284 | memset (&n, 0, sizeof (n)); |
285 | if (strlen (component) > 0 && component[0] != '*') | 285 | if (strlen (component) > 0 && component[0] != '*') |
286 | n.component = strdup (component); | 286 | n.component = GNUNET_strdup (component); |
287 | if (strlen (file) > 0 && file[0] != '*') | 287 | if (strlen (file) > 0 && file[0] != '*') |
288 | { | 288 | { |
289 | n.file = strdup (file); | 289 | n.file = GNUNET_strdup (file); |
290 | n.strlen_file = strlen (file); | 290 | n.strlen_file = strlen (file); |
291 | } | 291 | } |
292 | if ( (NULL != function) && | 292 | if ( (NULL != function) && |
293 | (strlen (function) > 0) && | 293 | (strlen (function) > 0) && |
294 | (function[0] != '*') ) | 294 | (function[0] != '*') ) |
295 | n.function = strdup (function); | 295 | n.function = GNUNET_strdup (function); |
296 | n.from_line = from_line; | 296 | n.from_line = from_line; |
297 | n.to_line = to_line; | 297 | n.to_line = to_line; |
298 | n.level = level; | 298 | n.level = level; |
@@ -403,7 +403,7 @@ parse_definitions (const char *constname, int force) | |||
403 | tmp = getenv (constname); | 403 | tmp = getenv (constname); |
404 | if (tmp == NULL) | 404 | if (tmp == NULL) |
405 | return 0; | 405 | return 0; |
406 | def = strdup (tmp); | 406 | def = GNUNET_strdup (tmp); |
407 | level = -1; | 407 | level = -1; |
408 | from_line = 0; | 408 | from_line = 0; |
409 | to_line = INT_MAX; | 409 | to_line = INT_MAX; |
@@ -532,7 +532,7 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) | |||
532 | GNUNET_free_non_null (component); | 532 | GNUNET_free_non_null (component); |
533 | GNUNET_asprintf (&component, "%s-%d", comp, getpid ()); | 533 | GNUNET_asprintf (&component, "%s-%d", comp, getpid ()); |
534 | GNUNET_free_non_null (component_nopid); | 534 | GNUNET_free_non_null (component_nopid); |
535 | component_nopid = strdup (comp); | 535 | component_nopid = GNUNET_strdup (comp); |
536 | 536 | ||
537 | env_logfile = getenv ("GNUNET_FORCE_LOGFILE"); | 537 | env_logfile = getenv ("GNUNET_FORCE_LOGFILE"); |
538 | if (env_logfile != NULL) | 538 | if (env_logfile != NULL) |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index 688cc448e..080496bbc 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -178,7 +178,7 @@ get_path_from_dyld_image () | |||
178 | path = _dyld_get_image_name (i); | 178 | path = _dyld_get_image_name (i); |
179 | if (path != NULL && strlen (path) > 0) | 179 | if (path != NULL && strlen (path) > 0) |
180 | { | 180 | { |
181 | p = strdup (path); | 181 | p = GNUNET_strdup (path); |
182 | s = p + strlen (p); | 182 | s = p + strlen (p); |
183 | while ((s > p) && (*s != '/')) | 183 | while ((s > p) && (*s != '/')) |
184 | s--; | 184 | s--; |