Commit a24856fb5570402fd3046dfcfcb38784446b082c

Thomas de Grivel 2023-11-30T15:55:56

wip tests

diff --git a/libc3/buf.c b/libc3/buf.c
index 0156e9a..0188d18 100644
--- a/libc3/buf.c
+++ b/libc3/buf.c
@@ -198,9 +198,13 @@ s_buf * buf_init (s_buf *buf, bool p_free, uw size, s8 *p)
 
 s_buf * buf_init_1 (s_buf *buf, bool p_free, s8 *p)
 {
+  uw len;
   assert(buf);
   assert(p);
-  return buf_init(buf, p_free, strlen(p), p);
+  len = strlen(p);
+  buf_init(buf, p_free, len, p);
+  buf->wpos = len;
+  return buf;
 }
 
 s_buf * buf_init_1_copy (s_buf *buf, const s8 *p)
diff --git a/libc3/module.c b/libc3/module.c
index 576ed02..8d4c91d 100644
--- a/libc3/module.c
+++ b/libc3/module.c
@@ -114,10 +114,8 @@ s_str * module_path (const s_sym *module, const s_str *prefix,
   }
   if ((r = buf_write_1(&out, FACTS_EXT)) < 0)
     goto error;
-  buf_clean(&in);
   return buf_to_str(&out, dest);
  error:
-  buf_clean(&in);
   buf_clean(&out);
   return NULL;
 }