fixes
authorChristian Grothoff <christian@grothoff.org>
Fri, 27 Aug 2010 12:20:27 +0000 (12:20 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 27 Aug 2010 12:20:27 +0000 (12:20 +0000)
src/datacache/datacache.c
src/datacache/plugin_datacache_postgres.c
src/datacache/test_datacache_quota.c

index 6e9b0770878d0f5f723f07c629a90d9d7c1d2933..9c1a90bca2d0d262fe7d7b4479278a2d04ae0b90 100644 (file)
@@ -191,7 +191,6 @@ GNUNET_DATACACHE_create (struct GNUNET_SCHEDULER_Handle *sched,
       GNUNET_DATACACHE_destroy (ret);
       return NULL;
     }
-  GNUNET_assert (ret->api->get != NULL);
   return ret;
 }
 
@@ -245,7 +244,6 @@ GNUNET_DATACACHE_put (struct GNUNET_DATACACHE_Handle *h,
 {
   uint32_t used;
 
-  GNUNET_assert (h->api->get != NULL);
   used = h->api->put (h->api->cls,
                      key,
                      size,
@@ -287,7 +285,6 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
                      GNUNET_DATACACHE_Iterator iter,
                      void *iter_cls)
 {
-  GNUNET_assert (h->api->get != NULL);
   GNUNET_STATISTICS_update (h->stats,
                            gettext_noop ("# requests received"),
                            1,
@@ -301,7 +298,6 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h,
                                GNUNET_NO);
       return 0; /* can not be present */
     } 
-  GNUNET_assert (h->api->get != NULL);
   return h->api->get (h->api->cls,
                      key,
                      type,
index 6bf3c70111914016cff448aa812a28b2f9674ae7..1269790690f666dbd74af828b41439fa4a6ce111 100644 (file)
@@ -406,6 +406,8 @@ postgres_plugin_get (void *cls,
       PQclear (res);
       return 0; 
     }
+  if (iter == NULL)
+    return cnt;
   if ( (3 != PQnfields (res)) ||
        (sizeof (uint64_t) != PQfsize (res, 0)) ||
        (sizeof (uint32_t) != PQfsize (res, 1)))
@@ -494,9 +496,9 @@ postgres_plugin_del (void *cls)
       return GNUNET_SYSERR; 
     }
   if ( (3 != PQnfields (res)) ||
-       (sizeof (uint32_t) != PQfsize (res, 0)) ||
-       (sizeof (uint32_t) != PQfsize (res, 1)) ||
-       (sizeof (GNUNET_HashCode) != PQfsize (res, 2)) )
+       (sizeof (size) != PQfsize (res, 0)) ||
+       (sizeof (oid) != PQfsize (res, 1)) ||
+       (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 2)) )
     {
       GNUNET_break (0);
       PQclear (res);
index 9e1881bd863bf56a7b3931cac387bf1c954eb82b..ada5ae1715c57e7176bfbe55c3802e70c76406af 100644 (file)
@@ -88,7 +88,6 @@ run (void *cls,
                                        buf,
                                        1+i,
                                        exp));
-         fprintf (stderr, "G");
           ASSERT (0 < GNUNET_DATACACHE_get (h, 
                                            &k, 1+i, 
                                            NULL, NULL));