jcs
/subtext
/amendments
/278
util: Add a comment explaining EXPAND_TO_FIT
jcs made amendment 278 over 2 years ago
--- util.h Thu Sep 8 21:52:06 2022
+++ util.h Fri Nov 11 16:57:46 2022
@@ -34,6 +34,11 @@
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define BOUND(a, min, max) ((a) > (max) ? (max) : ((a) < (min) ? (min) : (a)))
+/*
+ * If var of var_size (of which used_size is used) is not big enough to
+ * hold add, expand it by grow_amount (to give headroom for subsequent
+ * expansion).
+ */
#define EXPAND_TO_FIT(var, var_size, used_size, add, grow_amount) { \
if ((used_size) + (add) >= (var_size)) { \
while ((used_size) + (add) >= (var_size)) { \