Commit f2ec0be4d61da9623149a5da2c857d86ff518628

Thomas de Grivel 2024-08-14T13:38:05

json_from_str

diff --git a/json/json.c b/json/json.c
index 7e5e445..1cbdf3e 100644
--- a/json/json.c
+++ b/json/json.c
@@ -86,3 +86,11 @@ s_tag * json_buf_parse (s_buf *buf, s_tag *dest)
   *dest = tmp;
   return dest;
 }
+
+s_tag * json_from_str (const s_str *src, s_tag *dest)
+{
+  s_tag *r;
+  s_buf buf;
+  buf_init_str(&buf, src);
+  return json_buf_parse(&buf, dest);
+}
diff --git a/json/json.h b/json/json.h
index 6e6a106..27c83b4 100644
--- a/json/json.h
+++ b/json/json.h
@@ -10,3 +10,12 @@
  * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
  * THIS SOFTWARE.
  */
+#ifndef KC3_JSON_H
+#define KC3_JSON_H
+
+#include <libkc3/types.h>
+
+s_tag * json_buf_parse (s_buf *buf, s_tag *dest);
+s_tag * json_from_str (const s_str *src, s_tag *dest);
+
+#endif /* KC3_JSON_H */