Commit 81e14f0af42dd49794e9210f04ac51762e2fe947

Thomas de Grivel 2023-01-30T09:46:26

init value

diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index acafd5d..107f925 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -23,17 +23,17 @@ sw buf_parse_bool (s_buf *buf, bool *p)
   character c;
   sw r;
   s_buf_save save;
-  bool value;
+  bool value = 2;
   assert(buf);
   buf_save_init(buf, &save);
   if ((r = buf_read_1(buf, "true")) < 0)
     goto clean;
-  if (r > 0)
+  else if (r > 0)
     value = true;
   else {
     if ((r = buf_read_1(buf, "false")) < 0)
       goto clean;
-    if (r > 0)
+    else if (r > 0)
       value = false;
   }
   if (r == 0)
@@ -43,6 +43,7 @@ sw buf_parse_bool (s_buf *buf, bool *p)
     r = 0;
     goto restore;
   }
+  assert(value == true || value == false);
   *p = value;
   goto clean;
  restore: