gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12773 - in gnunet/src: datastore fs hostlist util


From: gnunet
Subject: [GNUnet-SVN] r12773 - in gnunet/src: datastore fs hostlist util
Date: Mon, 30 Aug 2010 23:42:10 +0200

Author: grothoff
Date: 2010-08-30 23:42:10 +0200 (Mon, 30 Aug 2010)
New Revision: 12773

Modified:
   gnunet/src/datastore/plugin_datastore_postgres.c
   gnunet/src/fs/test_fs_uri.c
   gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
   gnunet/src/util/test_container_slist.c
Log:
nitpicks

Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c    2010-08-30 21:32:26 UTC 
(rev 12772)
+++ gnunet/src/datastore/plugin_datastore_postgres.c    2010-08-30 21:42:10 UTC 
(rev 12773)
@@ -992,6 +992,7 @@
       iter (iter_cls, 
            NULL, NULL, 0, NULL, 0, 0, 0, 
            GNUNET_TIME_UNIT_ZERO_ABS, 0);
+      GNUNET_free (nrc);
       return;
     }
   nrc->bnow = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()).value__;
@@ -1161,6 +1162,7 @@
       iter (iter_cls, 
            NULL, NULL, 0, NULL, 0, 0, 0, 
            GNUNET_TIME_UNIT_ZERO_ABS, 0);
+      GNUNET_free (nrc);
       return;
     }
   if ((PQntuples (ret) != 1) ||
@@ -1172,6 +1174,7 @@
       iter (iter_cls, 
            NULL, NULL, 0, NULL, 0, 0, 0, 
            GNUNET_TIME_UNIT_ZERO_ABS, 0);
+      GNUNET_free (nrc);
       return;
     }
   nrc->total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 
0, 0));
@@ -1181,6 +1184,7 @@
       iter (iter_cls, 
            NULL, NULL, 0, NULL, 0, 0, 0, 
            GNUNET_TIME_UNIT_ZERO_ABS, 0);
+      GNUNET_free (nrc);
       return;
     }
   nrc->off = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,

Modified: gnunet/src/fs/test_fs_uri.c
===================================================================
--- gnunet/src/fs/test_fs_uri.c 2010-08-30 21:32:26 UTC (rev 12772)
+++ gnunet/src/fs/test_fs_uri.c 2010-08-30 21:42:10 UTC (rev 12773)
@@ -38,8 +38,11 @@
   struct GNUNET_FS_Uri *ret;
   char *emsg;
 
-  if (NULL != GNUNET_FS_uri_parse ("gnunet://fs/ksk/++", &emsg))
-    ABORT ();
+  if (NULL != (ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/++", &emsg)))
+    {
+      GNUNET_FS_uri_destroy (ret);
+      ABORT ();
+    }
   GNUNET_free (emsg);
   ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/foo+bar", &emsg);
   if (ret == NULL)

Modified: gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c
===================================================================
--- gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c  2010-08-30 
21:32:26 UTC (rev 12772)
+++ gnunet/src/hostlist/test_gnunet_daemon_hostlist_learning.c  2010-08-30 
21:42:10 UTC (rev 12773)
@@ -288,8 +288,7 @@
                              uint32_t distance)
 {
   char *hostname;
-  char *expected_uri = GNUNET_malloc (MAX_URL_LEN);
-
+  char *expected_uri;
   unsigned long long port;
   size_t size;
   const struct GNUNET_MessageHeader * incoming;
@@ -299,10 +298,9 @@
                                                    "HTTPPORT",
                                                    &port))
     {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not read advertising server's configuration\n" );
-    if ( NULL != expected_uri ) GNUNET_free ( expected_uri );
-    return GNUNET_SYSERR;
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                 "Could not read advertising server's configuration\n" );
+      return GNUNET_SYSERR;
     }
 
   if ( GNUNET_SYSERR  == GNUNET_CONFIGURATION_get_value_string (adv_peer.cfg,
@@ -311,35 +309,23 @@
                                                    &hostname))
     hostname = GNUNET_RESOLVER_local_fqdn_get ();
 
-  if (NULL != hostname)
-    {
-      size = strlen (hostname);
-      if (size + 15 > MAX_URL_LEN)
-        {
-          GNUNET_break (0);
-        }
-      else
-        {
-          GNUNET_asprintf (&expected_uri,
-                           "http://%s:%u/";,
-                           hostname,
-                           (unsigned int) port);
-        }
-    }
-
+  GNUNET_asprintf (&expected_uri,
+                  "http://%s:%u/";,
+                  hostname != NULL ? hostname : "localhost",
+                  (unsigned int) port);   
   incoming = (const struct GNUNET_MessageHeader *) message;
   current_adv_uri = strdup ((char*) &incoming[1]);
   if ( 0 == strcmp( expected_uri, current_adv_uri ) )
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Recieved hostlist advertisement with URI `%s' as expected\n", 
current_adv_uri);
-    adv_arrived = GNUNET_YES;
-    adv_sent = GNUNET_YES;
-  }
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                 "Recieved hostlist advertisement with URI `%s' as 
expected\n", current_adv_uri);
+      adv_arrived = GNUNET_YES;
+      adv_sent = GNUNET_YES;
+    }
   else
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Expected URI `%s' and recieved URI `%s' differ\n", 
expected_uri, current_adv_uri);
-  GNUNET_free_non_null (expected_uri);
+  GNUNET_free (expected_uri);
   GNUNET_free_non_null (hostname);
   return GNUNET_OK;
 }

Modified: gnunet/src/util/test_container_slist.c
===================================================================
--- gnunet/src/util/test_container_slist.c      2010-08-30 21:32:26 UTC (rev 
12772)
+++ gnunet/src/util/test_container_slist.c      2010-08-30 21:42:10 UTC (rev 
12773)
@@ -58,11 +58,14 @@
        GNUNET_CONTAINER_slist_next (it), i--)
     {
       p = GNUNET_CONTAINER_slist_get (it, &s);
-      CHECK (p != NULL);
-      j = *(int *) p;
-      CHECK (i == j);
-      CHECK (s == sizeof (i));
 
+      if ( (p == NULL) ||
+          (i != (j = *(int *) p)) ||
+          (s != sizeof (i)) )
+       {
+         GNUNET_CONTAINER_slist_iter_destroy (it);
+         CHECK (0);
+       }
       j *= 2;
       GNUNET_CONTAINER_slist_insert (it,
                                      
GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]