Can remove the sender and/or the recipient from the key of the greylister.
[apps/pfixtools.git] / common / mem.h
index 44630ef..9d98b87 100644 (file)
 #define p_dupstr(p, len)        xmemdupstr((p), (len))
 #define p_realloc(pp, count)    xrealloc((void*)(pp), sizeof(**(pp)) * (count))
 
+#  define p_shrink(pp, goalnb, allocnb)           \
+    do {                                          \
+        if (*(allocnb) > (goalnb)) {              \
+            p_realloc(pp, (goalnb));              \
+            *(allocnb) = (goalnb);                \
+        }                                         \
+    } while(0)
+
 #  define p_alloc_nr(x) (((x) + 16) * 3 / 2)
 #  define p_allocgrow(pp, goalnb, allocnb)                  \
     do {                                                    \