LRN: Use GNUNET_strdup() instead of strdup()
authorChristian Grothoff <christian@grothoff.org>
Fri, 14 Oct 2011 07:23:11 +0000 (07:23 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 14 Oct 2011 07:23:11 +0000 (07:23 +0000)
src/dv/gnunet-service-dv.c
src/hostlist/hostlist-client.c
src/transport/gnunet-transport-connect-running-peers.c
src/transport/transport-testing.c
src/util/common_logging.c
src/util/os_installation.c

index e58fd70e41b37cb60ed85cc962c806a77f0c0d02..44fa9dee562ab59b696ebdac2985c2b452c96ba9 100644 (file)
@@ -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);
index 3343b7a497eeaebebdae605fec80a9fe82713b07..1cc5836af6ae3842befb70d1d7ca72ebfa5ba259 100644 (file)
@@ -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);
 }
 
 
index 9b60ba1762e2d0e540546611889f65d9ac684fc5..131961c234b8430f4f1c0684470a1134bdc41ed7 100644 (file)
@@ -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));
index 76d88ab848bbc3de45e30e6550c5dd554ccaaab5..2e0ca1e5502796773f31ebb7665feaa8e9b298d5 100644 (file)
@@ -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;
 }
index 503fb671de77659a92641da06b90586c8188d3ef..1d3843cfd33658aa5606d8901729d29e43b36fb3 100644 (file)
@@ -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)
index 688cc448e153b719c3995fa8b6db34570dd05399..080496bbc260ba0140d187dcedace96aad385c17 100644 (file)
@@ -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--;