pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] abt.c: Permit NULL as the reaugment argument.


From: John Darrington
Subject: [PATCH] abt.c: Permit NULL as the reaugment argument.
Date: Sun, 19 May 2019 14:48:46 +0200

If augmentation is not required, then NULL may be passed as the reaugment 
function.
---
 src/libpspp/abt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/libpspp/abt.c b/src/libpspp/abt.c
index ae746183..d446bcd4 100644
--- a/src/libpspp/abt.c
+++ b/src/libpspp/abt.c
@@ -39,6 +39,11 @@ static struct abt_node **down_link (struct abt *, struct 
abt_node *);
 static struct abt_node *skew (struct abt *, struct abt_node *);
 static struct abt_node *split (struct abt *, struct abt_node *);
 
+static void
+dummy_augment (struct abt_node *node UNUSED, const void *aux UNUSED)
+{
+}
+
 /* Initializes ABT as an empty ABT that uses COMPARE and
    REAUGMENT functions, passing in AUX as auxiliary data.
 
@@ -55,10 +60,11 @@ abt_init (struct abt *abt,
           abt_reaugment_func *reaugment,
           const void *aux)
 {
-  assert (reaugment != NULL);
   abt->root = NULL;
   abt->compare = compare;
   abt->reaugment = reaugment;
+  if (abt->reaugment == NULL)
+    abt->reaugment = dummy_augment;
   abt->aux = aux;
 }
 
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]