From a0b178aa52170a1f8f6582f8541f4c91be943154 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 14 Oct 2011 07:23:11 +0000 Subject: [PATCH] LRN: Use GNUNET_strdup() instead of strdup() --- src/dv/gnunet-service-dv.c | 2 +- src/hostlist/hostlist-client.c | 4 ++-- src/transport/gnunet-transport-connect-running-peers.c | 2 +- src/transport/transport-testing.c | 6 +++--- src/util/common_logging.c | 10 +++++----- 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, pos = dn->referee_head; while ((NULL != pos) && (pos->referrer_id != sid)) { - sender_id = strdup (GNUNET_i2s (&pos->identity)); + sender_id = GNUNET_strdup (GNUNET_i2s (&pos->identity)); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I know sender %u %s\n", pos->referrer_id, sender_id); 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 () GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing new advertised hostlist if it is obtainable\n"); current_hostlist = hostlist_to_test; - return strdup (hostlist_to_test->hostlist_uri); + return GNUNET_strdup (hostlist_to_test->hostlist_uri); } if ((GNUNET_YES == stat_use_bootstrap) || (linked_list_size == 0)) @@ -465,7 +465,7 @@ download_get_url () GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using learned hostlist `%s'\n", pos->hostlist_uri); current_hostlist = pos; - return strdup (pos->hostlist_uri); + return GNUNET_strdup (pos->hostlist_uri); } 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 testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) { cc = NULL; - char *p1_c = strdup (GNUNET_i2s (&p1->id)); + char *p1_c = GNUNET_strdup (GNUNET_i2s (&p1->id)); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Peers connected: %s <-> %s\n", p1_c, 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) if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; - char * p2_s = strdup(GNUNET_i2s (&p2->id)); + char * p2_s = GNUNET_strdup(GNUNET_i2s (&p2->id)); GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", "Asking peers %u (`%s') to connect peer %u (`%s')\n", p1->no, GNUNET_i2s (&p1->id), p2->no, p2_s); @@ -481,7 +481,7 @@ GNUNET_TRANSPORT_TESTING_init () char * extract_filename (const char *file) { - char *pch = strdup (file); + char *pch = GNUNET_strdup (file); char *backup = pch; char *filename = NULL; char *res; @@ -501,7 +501,7 @@ extract_filename (const char *file) else filename = pch; - res = strdup (filename); + res = GNUNET_strdup (filename); GNUNET_free (backup); return res; } 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, struct LogDef n; memset (&n, 0, sizeof (n)); if (strlen (component) > 0 && component[0] != '*') - n.component = strdup (component); + n.component = GNUNET_strdup (component); if (strlen (file) > 0 && file[0] != '*') { - n.file = strdup (file); + n.file = GNUNET_strdup (file); n.strlen_file = strlen (file); } if ( (NULL != function) && (strlen (function) > 0) && (function[0] != '*') ) - n.function = strdup (function); + n.function = GNUNET_strdup (function); n.from_line = from_line; n.to_line = to_line; n.level = level; @@ -403,7 +403,7 @@ parse_definitions (const char *constname, int force) tmp = getenv (constname); if (tmp == NULL) return 0; - def = strdup (tmp); + def = GNUNET_strdup (tmp); level = -1; from_line = 0; to_line = INT_MAX; @@ -532,7 +532,7 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) GNUNET_free_non_null (component); GNUNET_asprintf (&component, "%s-%d", comp, getpid ()); GNUNET_free_non_null (component_nopid); - component_nopid = strdup (comp); + component_nopid = GNUNET_strdup (comp); env_logfile = getenv ("GNUNET_FORCE_LOGFILE"); 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 () path = _dyld_get_image_name (i); if (path != NULL && strlen (path) > 0) { - p = strdup (path); + p = GNUNET_strdup (path); s = p + strlen (p); while ((s > p) && (*s != '/')) s--; -- 2.25.1