[master] b474c9cce Neuter the VRBT_AUGMENT facility if not used.
Nils Goroll
nils.goroll at uplex.de
Wed Nov 10 12:36:07 UTC 2021
commit b474c9ccee2b119e6b9556179dcaf2c0808b15af
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Mar 23 11:43:34 2021 +0000
Neuter the VRBT_AUGMENT facility if not used.
diff --git a/include/vtree.h b/include/vtree.h
index 16122b62c..b4913c8ea 100644
--- a/include/vtree.h
+++ b/include/vtree.h
@@ -370,7 +370,16 @@ struct { \
* from the bottom up to the root, to update augmented node data.
*/
#ifndef VRBT_AUGMENT
-#define VRBT_AUGMENT(x) break
+#define VRBT_AUGMENT(x) do {} while (0)
+#define VRBT_AUGMENT_UP(x) do {} while (0)
+#else
+#define VRBT_AUGMENT_UP(x) \
+ do { \
+ while((x) != NULL) { \
+ VRBT_AUGMENT(x); \
+ x = VRBT_PARENT(x, field); \
+ } \
+ } while (0)
#endif
#define VRBT_SWAP_CHILD(head, out, in, field) do { \
@@ -631,10 +640,7 @@ name##_VRBT_REMOVE(struct name *head, struct type *elm) \
VRBT_SET_PARENT(child, parent, field); \
if (parent != NULL) \
name##_VRBT_REMOVE_COLOR(head, parent, child); \
- while (parent != NULL) { \
- VRBT_AUGMENT(parent); \
- parent = VRBT_PARENT(parent, field); \
- } \
+ VRBT_AUGMENT_UP(parent); \
return (old); \
}
@@ -665,10 +671,7 @@ name##_VRBT_INSERT(struct name *head, struct type *elm) \
else \
VRBT_RIGHT(parent, field) = elm; \
name##_VRBT_INSERT_COLOR(head, elm); \
- while (elm != NULL) { \
- VRBT_AUGMENT(elm); \
- elm = VRBT_PARENT(elm, field); \
- } \
+ VRBT_AUGMENT_UP(elm); \
return (NULL); \
}
More information about the varnish-commit
mailing list