guix-env: some update.
[oweals/gnunet.git] / src / set / gnunet-service-set_union_strata_estimator.c
index 59d81e134a3167f002607cc3f3fd62e877a6868c..e3d6bfaec702369ea089f3b6391d4ef83f51506d 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      Copyright (C) 2012 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2012 GNUnet e.V.
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -71,7 +71,7 @@ strata_estimator_write (const struct StrataEstimator *se,
                                 &cbuf,
                                 &nsize))
     {
-      memcpy (buf, cbuf, nsize);
+      GNUNET_memcpy (buf, cbuf, nsize);
       osize = nsize;
       GNUNET_free (cbuf);
     }
@@ -123,6 +123,7 @@ strata_estimator_read (const void *buf,
     GNUNET_free_non_null (dbuf);
     return GNUNET_SYSERR;
   }
+
   for (i = 0; i < se->strata_count; i++)
   {
     ibf_read_slice (buf, 0, se->ibf_size, se->strata[i]);
@@ -202,6 +203,8 @@ strata_estimator_create (unsigned int strata_count,
     se->strata[i] = ibf_create (ibf_size, ibf_hashnum);
     if (NULL == se->strata[i])
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Failed to allocate memory for strata estimator\n");
       for (j = 0; j < i; j++)
         ibf_destroy (se->strata[i]);
       GNUNET_free (se);
@@ -277,7 +280,8 @@ strata_estimator_dup (struct StrataEstimator *se)
   c = GNUNET_new (struct StrataEstimator);
   c->strata_count = se->strata_count;
   c->ibf_size = se->ibf_size;
-  c->strata = GNUNET_malloc (sizeof (struct InvertibleBloomFilter *) * se->strata_count);
+  c->strata = GNUNET_new_array (se->strata_count,
+                                struct InvertibleBloomFilter *);
   for (i = 0; i < se->strata_count; i++)
     c->strata[i] = ibf_dup (se->strata[i]);
   return c;