use putenv instead of setenv for portability
[oweals/gnunet.git] / src / util / container_bloomfilter.c
index b7be764b5b9d8ec28fb13d416ad0039ab4e20f49..180aab4c3ccbecc903f4d259fc62fc75b4d24db1 100644 (file)
 #include "gnunet_container_lib.h"
 #include "gnunet_disk_lib.h"
 
+#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
+
+#define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall)
+
+#define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
+
 struct GNUNET_CONTAINER_BloomFilter
 {
 
@@ -319,8 +325,8 @@ makeEmptyFile (const struct GNUNET_DISK_FileHandle *fh, size_t size)
  * @return GNUNET_YES to continue, GNUNET_NO to stop early
  */
 typedef int (*BitIterator) (void *cls,
-                           const struct GNUNET_CONTAINER_BloomFilter * bf,
-                           unsigned int bit);
+                            const struct GNUNET_CONTAINER_BloomFilter * bf,
+                            unsigned int bit);
 
 
 /**
@@ -349,10 +355,10 @@ iterateBits (const struct GNUNET_CONTAINER_BloomFilter *bf,
     while (slot < (sizeof (GNUNET_HashCode) / sizeof (uint32_t)))
     {
       if (GNUNET_YES !=
-         callback (arg, bf,
-                   (((uint32_t *) & tmp[round & 1])[slot]) &
-                   ((bf->bitArraySize * 8) - 1)))
-       return;
+          callback (arg, bf,
+                    (((uint32_t *) & tmp[round & 1])[slot]) &
+                    ((bf->bitArraySize * 8) - 1)))
+        return;
       slot++;
       bitCount--;
       if (bitCount == 0)
@@ -499,8 +505,7 @@ GNUNET_CONTAINER_bloomfilter_load (const char *filename, size_t size,
     res = GNUNET_DISK_file_read (bf->fh, rbuff, BUFFSIZE);
     if (res == -1)
     {
-      GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "read",
-                                bf->filename);
+      LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "read", bf->filename);
     }
     if (res == 0)
       break;                    /* is ok! we just did not use that many bits yet */