Commit 3bd2aa171c17f406b0c71c2639075a93886b794c

Thomas de Grivel 2024-10-15T13:57:29

fix tag_not

diff --git a/libkc3/tag.c b/libkc3/tag.c
index 2b4260c..05ef360 100644
--- a/libkc3/tag.c
+++ b/libkc3/tag.c
@@ -970,11 +970,17 @@ s_tag * tag_new_copy (const s_tag *src)
 
 bool * tag_not (const s_tag *tag, bool *dest)
 {
-  s_tag f;
+  bool b;
   assert(tag);
   assert(dest);
-  tag_init_bool(&f, false);
-  *dest = compare_tag(tag, &f) == 0 ? true : false;
+  if (! bool_init_cast(&b, tag)) {
+    err_write_1("tag_not: bool_init_cast: ");
+    err_inspect_tag(tag);
+    err_write_1("\n");
+    assert(! "tag_not: bool_init_cast");
+    return NULL;
+  }
+  *dest = ! b;
   return dest;
 }