diff --git a/libc3/arg.c b/libc3/arg.c
index 3103448..c6477a0 100644
--- a/libc3/arg.c
+++ b/libc3/arg.c
@@ -35,7 +35,7 @@ void arg_delete_all (s_arg *arg)
s_arg * arg_init (s_arg *arg)
{
assert(arg);
- bzero(arg, sizeof(s_arg));
+ *arg = (s_arg) {0};
return arg;
}
diff --git a/libc3/array.c b/libc3/array.c
index e89334b..ebe550b 100644
--- a/libc3/array.c
+++ b/libc3/array.c
@@ -216,13 +216,12 @@ s_array * array_init_copy (s_array *a, const s_array *src)
u8 *data_src;
uw i = 0;
uw item_size;
- s_array tmp;
+ s_array tmp = {0};
assert(a);
assert(src);
assert(src->dimension);
assert(src->dimensions);
(void) i;
- bzero(&tmp, sizeof(s_array));
if (! src->dimension) {
assert(! "array_init_copy: zero dimension");
errx(1, "array_init_copy: zero dimension");
diff --git a/libc3/buf_parse.c b/libc3/buf_parse.c
index 7c061a0..1ad1000 100644
--- a/libc3/buf_parse.c
+++ b/libc3/buf_parse.c
@@ -47,11 +47,10 @@ sw buf_parse_array (s_buf *buf, s_array *dest)
sw r;
sw result = 0;
s_buf_save save;
- s_array tmp;
+ s_array tmp = {0};
assert(buf);
assert(dest);
buf_save_init(buf, &save);
- bzero(&tmp, sizeof(tmp));
if ((r = buf_parse_paren_sym(buf, &tmp.type)) <= 0)
goto clean;
result += r;
@@ -638,14 +637,12 @@ sw buf_parse_call_op_rec (s_buf *buf, s_call *dest, u8 min_precedence)
s_tag *right;
s_buf_save save;
s_call tmp;
- s_call tmp2;
- s_call tmp3;
+ s_call tmp2 = {0};
+ s_call tmp3 = {0};
assert(buf);
assert(dest);
buf_save_init(buf, &save);
call_init_op(&tmp);
- bzero(&tmp2, sizeof(s_call));
- bzero(&tmp3, sizeof(s_call));
left = &tmp.arguments->tag;
right = &list_next(tmp.arguments)->tag;
tag_init_copy(left, &dest->arguments->tag);
diff --git a/libc3/call.c b/libc3/call.c
index 4af4be6..ba22f09 100644
--- a/libc3/call.c
+++ b/libc3/call.c
@@ -210,7 +210,7 @@ bool call_op_get (s_call *call, s_facts *facts)
s_call * call_init (s_call *call)
{
assert(call);
- bzero(call, sizeof(s_call));
+ *call = (s_call) {0};
return call;
}
@@ -239,10 +239,11 @@ s_call * call_init_1 (s_call *call, const s8 *p)
s_call * call_init_cast (s_call *call, const s_sym *type,
const s_tag *tag)
{
+ s_call tmp = {0};
assert(call);
- bzero(call, sizeof(s_call));
- ident_init(&call->ident, type, sym_1("cast"));
- call->arguments = list_new_copy(tag, NULL);
+ ident_init(&tmp.ident, type, sym_1("cast"));
+ tmp.arguments = list_new_copy(tag, NULL);
+ *call = tmp;
return call;
}
@@ -259,17 +260,19 @@ s_call * call_init_copy (s_call *call, const s_call *src)
s_call * call_init_op (s_call *call)
{
+ s_call tmp = {0};
assert(call);
- bzero(call, sizeof(s_call));
- call->arguments = list_new(list_new(NULL));
+ tmp.arguments = list_new(list_new(NULL));
+ *call = tmp;
return call;
}
s_call * call_init_op_unary (s_call *call)
{
+ s_call tmp = {0};
assert(call);
- bzero(call, sizeof(s_call));
- call->arguments = list_new(NULL);
+ tmp.arguments = list_new(NULL);
+ *call = tmp;
return call;
}
diff --git a/libc3/cfn.c b/libc3/cfn.c
index 8f2fc54..ca3a4a3 100644
--- a/libc3/cfn.c
+++ b/libc3/cfn.c
@@ -10,7 +10,7 @@
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
-#include <assert.h>
+#include "assert.h"
#include <dlfcn.h>
#include <err.h>
#include <stdlib.h>
@@ -150,18 +150,19 @@ s_cfn * cfn_init (s_cfn *cfn, const s_sym *name, s_list *arg_types,
const s_sym *result_type)
{
sw arity;
+ s_cfn tmp = {0};
assert(cfn);
- bzero(cfn, sizeof(s_cfn));
- cfn->name = name;
- cfn->arg_types = arg_types;
- arity = list_length(arg_types);
+ tmp.name = name;
+ tmp.arg_types = arg_types;
+ arity = list_length(tmp.arg_types);
if (arity > 255) {
assert(arity <= 255);
- errx(1, "cfn_init: arity > 255");
+ err_puts("cfn_init: arity > 255");
return NULL;
}
- cfn->arity = arity;
- cfn->result_type = result_type;
+ tmp.arity = arity;
+ tmp.result_type = result_type;
+ *cfn = tmp;
return cfn;
}
@@ -247,13 +248,15 @@ s_cfn * cfn_prep_cif (s_cfn *cfn)
s_tag * cfn_tag_init (s_tag *tag, const s_sym *type)
{
+ s_tag tmp = {0};
assert(tag);
assert(type);
- bzero(tag, sizeof(s_tag));
- if (! sym_to_tag_type(type, &tag->type)) {
+ if (! sym_to_tag_type(type, &tmp.type)) {
+ err_write_1("cfn_tag_init: invalid type: ");
+ err_puts(type->str.ptr.ps8);
assert(! "cfn_tag_init: invalid type");
- errx(1, "cfn_tag_init: invalid type: %s", type->str.ptr.ps8);
return NULL;
}
+ *tag = tmp;
return tag;
}
diff --git a/libc3/fn.c b/libc3/fn.c
index a3b4088..81bcfba 100644
--- a/libc3/fn.c
+++ b/libc3/fn.c
@@ -38,7 +38,7 @@ void fn_delete (s_fn *fn)
s_fn * fn_init (s_fn *fn)
{
assert(fn);
- bzero(fn, sizeof(s_fn));
+ *fn = (s_fn) {0};
return fn;
}
diff --git a/libc3/fn_clause.c b/libc3/fn_clause.c
index 5006cec..3be580e 100644
--- a/libc3/fn_clause.c
+++ b/libc3/fn_clause.c
@@ -60,9 +60,10 @@ void fn_clause_delete_all (s_fn_clause *fn_clause)
s_fn_clause * fn_clause_init (s_fn_clause *fn_clause, s_fn_clause *next_clause)
{
+ s_fn_clause tmp = {0};
assert(fn_clause);
- bzero(fn_clause, sizeof(s_fn_clause));
- fn_clause->next_clause = next_clause;
+ tmp.next_clause = next_clause;
+ *fn_clause = tmp;
return fn_clause;
}
diff --git a/libc3/hash.c b/libc3/hash.c
index 04954f7..83610ff 100644
--- a/libc3/hash.c
+++ b/libc3/hash.c
@@ -29,7 +29,7 @@
void hash_clean (t_hash *hash)
{
- bzero(hash, sizeof(t_hash));
+ *hash = (t_hash) {0};
}
void hash_init (t_hash *hash)
diff --git a/libc3/skiplist_node.c.in b/libc3/skiplist_node.c.in
index fd003a9..0c95235 100644
--- a/libc3/skiplist_node.c.in
+++ b/libc3/skiplist_node.c.in
@@ -12,7 +12,7 @@
*/
/* Gen from skiplist_node.c.in NAME=_NAME$ TYPE=_TYPE$ */
#include <stdlib.h>
-#include <strings.h>
+#include <string.h>
#include "skiplist_node___NAME$.h"
s_skiplist_node___NAME$ *
@@ -20,8 +20,8 @@ skiplist_node_init (s_skiplist_node___NAME$ *node, _TYPE$ _NAME$, u8 height)
{
node->_NAME$ = _NAME$;
node->height = height;
- bzero(SKIPLIST_NODE_LINKS___NAME$(node),
- height * sizeof(s_skiplist_node___NAME$ *));
+ memset(SKIPLIST_NODE_LINKS___NAME$(node), 0,
+ height * sizeof(s_skiplist_node___NAME$ *));
return node;
}
diff --git a/libc3/skiplist_node__fact.c b/libc3/skiplist_node__fact.c
index 5fa1475..a14a8eb 100644
--- a/libc3/skiplist_node__fact.c
+++ b/libc3/skiplist_node__fact.c
@@ -12,7 +12,7 @@
*/
/* Gen from skiplist_node.c.in NAME=fact TYPE=s_fact * */
#include <stdlib.h>
-#include <strings.h>
+#include <string.h>
#include "skiplist_node__fact.h"
s_skiplist_node__fact *
@@ -20,8 +20,8 @@ skiplist_node_init (s_skiplist_node__fact *node, s_fact * fact, u8 height)
{
node->fact = fact;
node->height = height;
- bzero(SKIPLIST_NODE_LINKS__fact(node),
- height * sizeof(s_skiplist_node__fact *));
+ memset(SKIPLIST_NODE_LINKS__fact(node), 0,
+ height * sizeof(s_skiplist_node__fact *));
return node;
}
diff --git a/libc3/tag.c b/libc3/tag.c
index 8cdf8c9..ce3c549 100644
--- a/libc3/tag.c
+++ b/libc3/tag.c
@@ -59,16 +59,6 @@ bool * tag_and (const s_tag *a, const s_tag *b, bool *dest)
return dest;
}
-/*
-s_tag * tag_array (s_tag *tag, const s_sym *type, uw dimension,
- const uw *dimensions)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_array(tag, type, dimension, dimensions);
-}
-*/
-
s_tag * tag_bnot (const s_tag *tag, s_tag *result)
{
assert(tag);
@@ -105,15 +95,6 @@ s_tag * tag_bnot (const s_tag *tag, s_tag *result)
return NULL;
}
-/*
-s_tag * tag_bool (s_tag *tag, bool b)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_bool(tag, b);
-}
-*/
-
s_tag * tag_cast_integer_to_s8 (s_tag *tag)
{
s8 i;
@@ -186,15 +167,6 @@ s_tag * tag_cast_integer_to_u64 (s_tag *tag)
return tag_u64(tag, i);
}
-/*
-s_tag * tag_character (s_tag *tag, character x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_character(tag, x);
-}
-*/
-
void tag_clean (s_tag *tag)
{
assert(tag);
@@ -345,22 +317,6 @@ s_tag * tag_equal (const s_tag *a, const s_tag *b, s_tag *dest)
return dest;
}
-/*
-s_tag * tag_f32 (s_tag *tag, f32 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_f32(tag, x);
-}
-
-s_tag * tag_f64 (s_tag *tag, f64 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_f64(tag, x);
-}
-*/
-
bool * tag_gt (const s_tag *a, const s_tag *b, bool *dest)
{
assert(a);
@@ -397,22 +353,6 @@ uw tag_hash_uw (const s_tag *tag)
return hash_to_uw(&hash);
}
-/*
-s_tag * tag_ident (s_tag *tag, const s_ident *x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_ident(tag, x);
-}
-
-s_tag * tag_ident_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_ident_1(tag, p);
-}
-*/
-
bool tag_ident_is_bound (const s_tag *tag)
{
return env_tag_ident_is_bound(&g_c3_env, tag, &g_c3_env.facts);
@@ -420,7 +360,7 @@ bool tag_ident_is_bound (const s_tag *tag)
s_tag * tag_init (s_tag *tag)
{
- bzero(tag, sizeof(s_tag));
+ *tag = (s_tag) {0};
return tag;
}
@@ -444,255 +384,6 @@ s_tag * tag_init_1 (s_tag *tag, const s8 *p)
return tag;
}
-/*
-s_tag * tag_init_array (s_tag *tag, const s_sym *type,
- uw dimension, const uw *dimensions)
-{
- assert(tag);
- tag->type = TAG_ARRAY;
- array_init(&tag->data.array, type, dimension, dimensions);
- return tag;
-}
-
-s_tag * tag_init_bool (s_tag *tag, bool b)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_BOOL;
- tag->data.bool = b;
- return tag;
-}
-
-s_tag * tag_init_character (s_tag *tag, character c)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_CHARACTER;
- tag->data.character = c;
- return tag;
-}
-
-s_tag * tag_init_f32 (s_tag *tag, f32 x)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_F32;
- tag->data.f32 = x;
- return tag;
-}
-
-s_tag * tag_init_f64 (s_tag *tag, f64 x)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_F64;
- tag->data.f64 = x;
- return tag;
-}
-
-s_tag * tag_init_ident (s_tag *tag, const s_ident *x)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_IDENT;
- tag->data.ident = *x;
- return tag;
-}
-
-s_tag * tag_init_ident_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_IDENT;
- ident_init_1(&tag->data.ident, p);
- return tag;
-}
-
-s_tag * tag_init_integer (s_tag *tag, const s_integer *i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_INTEGER;
- integer_init_copy(&tag->data.integer, i);
- return tag;
-}
-*/
-
-/*
-s_tag * tag_init_integer_1 (s_tag *tag, const s8 *p)
-{
- s_buf buf;
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_INTEGER;
- buf_init_1(&buf, p);
- if (buf_parse_integer(&buf, &tag->data.integer) != (sw) strlen(p)) {
- assert(! "tag_init_integer_1: invalid integer");
- errx(1, "tag_init_integer_1: invalid integer");
- buf_clean(&buf);
- return NULL;
- }
- buf_clean(&buf);
- return tag;
-}
-*/
-
-s_tag * tag_init_integer_s64 (s_tag *tag, s64 s)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_INTEGER;
- integer_init_s64(&tag->data.integer, s);
- return tag;
-}
-
-s_tag * tag_init_integer_u64 (s_tag *tag, u64 u)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_INTEGER;
- integer_init_u64(&tag->data.integer, u);
- return tag;
-}
-
-/*
-s_tag * tag_init_integer_zero (s_tag *tag)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_INTEGER;
- integer_init_zero(&tag->data.integer);
- return tag;
-}
-
-s_tag * tag_init_list (s_tag *tag, s_list *list)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_LIST;
- tag->data.list = list;
- return tag;
-}
-
-s_tag * tag_init_list_1 (s_tag *tag, const s8 *p)
-{
- s_buf buf;
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_LIST;
- buf_init_1(&buf, p);
- if (buf_parse_list(&buf, &tag->data.list) != (sw) strlen(p)) {
- assert(! "tag_init_list_1: invalid list");
- errx(1, "tag_init_list_1: invalid list");
- buf_clean(&buf);
- return NULL;
- }
- buf_clean(&buf);
- return tag;
-}
-
-s_tag * tag_init_map (s_tag *tag, uw count)
-{
- assert(tag);
- tag->type = TAG_MAP;
- if (! map_init(&tag->data.map, count))
- return NULL;
- return tag;
-}
-
-s_tag * tag_init_map_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- tag->type = TAG_MAP;
- if (! map_init_1(&tag->data.map, p))
- return NULL;
- return tag;
-}
-
-s_tag * tag_init_s8 (s_tag *tag, s8 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_S8;
- tag->data.s8 = i;
- return tag;
-}
-
-s_tag * tag_init_s16 (s_tag *tag, s16 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_S16;
- tag->data.s16 = i;
- return tag;
-}
-
-s_tag * tag_init_s32 (s_tag *tag, s32 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_S32;
- tag->data.s32 = i;
- return tag;
-}
-
-s_tag * tag_init_s64 (s_tag *tag, s64 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_S64;
- tag->data.s64 = i;
- return tag;
-}
-
-s_tag * tag_init_sw (s_tag *tag, sw i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_SW;
- tag->data.sw = i;
- return tag;
-}
-
-s_tag * tag_init_str (s_tag *tag, s8 *free, uw size, const s8 *p)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_STR;
- str_init(&tag->data.str, free, size, p);
- return tag;
-}
-
-s_tag * tag_init_str_1 (s_tag *tag, s8 *free, const s8 *p)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_STR;
- str_init_1(&tag->data.str, free, p);
- return tag;
-}
-
-s_tag * tag_init_sym (s_tag *tag, const s_sym *p)
-{
- assert(tag);
- assert(p);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_SYM;
- tag->data.sym = p;
- return tag;
-}
-
-s_tag * tag_init_sym_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- assert(p);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_SYM;
- tag->data.sym = sym_1(p);
- return tag;
-}
-*/
-
s_tag * tag_init_time (s_tag *tag)
{
s_time time;
@@ -700,88 +391,6 @@ s_tag * tag_init_time (s_tag *tag)
return time_to_tag(&time, tag);
}
-/*
-s_tag * tag_init_tuple (s_tag *tag, uw count)
-{
- assert(tag);
- assert(count);
- tag->type = TAG_TUPLE;
- tuple_init(&tag->data.tuple, count);
- return tag;
-}
-
-s_tag * tag_init_tuple_2 (s_tag *tag, const s_tag *a, const s_tag *b)
-{
- assert(tag);
- assert(a);
- assert(b);
- tag->type = TAG_TUPLE;
- tuple_init_2(&tag->data.tuple, a, b);
- return tag;
-}
-
-s_tag * tag_init_u8 (s_tag *tag, u8 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_U8;
- tag->data.u8 = i;
- return tag;
-}
-
-s_tag * tag_init_u16 (s_tag *tag, u16 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_U16;
- tag->data.u16 = i;
- return tag;
-}
-
-s_tag * tag_init_u32 (s_tag *tag, u32 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_U32;
- tag->data.u32 = i;
- return tag;
-}
-
-s_tag * tag_init_u64 (s_tag *tag, u64 i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_U64;
- tag->data.u64 = i;
- return tag;
-}
-
-s_tag * tag_init_uw (s_tag *tag, uw i)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_UW;
- tag->data.uw = i;
- return tag;
-}
-
-s_tag * tag_init_var (s_tag *tag)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_VAR;
- return tag;
-}
-
-s_tag * tag_init_void (s_tag *tag)
-{
- assert(tag);
- bzero(tag, sizeof(s_tag));
- tag->type = TAG_VOID;
- return tag;
-}
-*/
-
s_str * tag_inspect (const s_tag *tag, s_str *dest)
{
s_buf buf;
@@ -802,22 +411,6 @@ s_str * tag_inspect (const s_tag *tag, s_str *dest)
return buf_to_str(&buf, dest);
}
-/*
-s_tag * tag_integer_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_integer_1(tag, p);
-}
-
-s_tag * tag_integer_copy (s_tag *tag, const s_integer *x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_integer_copy(tag, x);
-}
-*/
-
s_tag * tag_integer_reduce (s_tag *tag)
{
uw bytes;
@@ -882,15 +475,6 @@ bool tag_is_unbound_var (const s_tag *tag)
return (tag && tag->type == TAG_VAR);
}
-/*
-s_tag * tag_list (s_tag *tag, s_list *x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_list(tag, x);
-}
-*/
-
s_tag * tag_list_1 (s_tag *tag, const s8 *p)
{
s_tag tmp = {0};
@@ -920,23 +504,6 @@ bool * tag_lte (const s_tag *a, const s_tag *b, bool *dest)
return dest;
}
-/*
-s_tag * tag_map (s_tag *tag, uw count)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_map(tag, count);
-}
-
-s_tag * tag_map_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- assert(p);
- tag_clean(tag);
- return tag_init_map_1(tag, p);
-}
-*/
-
s_tag * tag_neg (const s_tag *tag, s_tag *result)
{
s_integer tmp;
@@ -1012,23 +579,6 @@ s_tag * tag_new_1 (const s8 *p)
return tag_init_1(tag, p);
}
-/*
-s_tag * tag_new_array (const s_sym *type, uw dimension,
- const uw *dimensions)
-{
- s_tag *dest;
- if (! (dest = malloc(sizeof(s_tag)))) {
- warnx("tag_new_array: out of memory");
- return NULL;
- }
- if (! tag_init_array(dest, type, dimension, dimensions)) {
- free(dest);
- return NULL;
- }
- return dest;
-}
-*/
-
s_tag * tag_new_copy (const s_tag *src)
{
s_tag *dest;
@@ -1037,15 +587,6 @@ s_tag * tag_new_copy (const s_tag *src)
return tag_init_copy(dest, src);
}
-/*
-s_tag * tag_new_var (void)
-{
- s_tag *tag;
- tag = calloc(1, sizeof(s_tag));
- return tag_init_var(tag);
-}
-*/
-
bool * tag_not (const s_tag *tag, bool *dest)
{
s_tag f;
@@ -1091,71 +632,6 @@ sw tag_size (const s_tag *tag)
return sym_type_size(type);
}
-/*
-s_tag * tag_s8 (s_tag *tag, s8 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_s8(tag, x);
-}
-
-s_tag * tag_s16 (s_tag *tag, s16 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_s16(tag, x);
-}
-
-s_tag * tag_s32 (s_tag *tag, s32 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_s32(tag, x);
-}
-
-s_tag * tag_s64 (s_tag *tag, s64 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_s64(tag, x);
-}
-
-s_tag * tag_sw (s_tag *tag, sw x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_sw(tag, x);
-}
-
-s_tag * tag_str (s_tag *tag, s8 *free, uw size, const s8 *p)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_str(tag, free, size, p);
-}
-
-s_tag * tag_str_1 (s_tag *tag, s8 *free, const s8 *p)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_str_1(tag, free, p);
-}
-
-s_tag * tag_sym (s_tag *tag, const s_sym *x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_sym(tag, x);
-}
-
-s_tag * tag_sym_1 (s_tag *tag, const s8 *p)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_sym_1(tag, p);
-}
-*/
-
void * tag_to_ffi_pointer (s_tag *tag, const s_sym *type)
{
if (type == sym_1("Tag") ||
@@ -1419,22 +895,6 @@ void * tag_to_pointer (s_tag *tag, const s_sym *type)
}
-/*
-s_tag * tag_tuple (s_tag *tag, uw count)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_tuple(tag, count);
-}
-
-s_tag * tag_tuple_2 (s_tag *tag, const s_tag *a, const s_tag *b)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_tuple_2(tag, a, b);
-}
-*/
-
const s_sym ** tag_type (const s_tag *tag, const s_sym **dest)
{
assert(tag);
@@ -1443,57 +903,6 @@ const s_sym ** tag_type (const s_tag *tag, const s_sym **dest)
return dest;
}
-/*
-s_tag * tag_u8 (s_tag *tag, u8 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_u8(tag, x);
-}
-
-s_tag * tag_u16 (s_tag *tag, u16 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_u16(tag, x);
-}
-
-s_tag * tag_u32 (s_tag *tag, u32 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_u32(tag, x);
-}
-
-s_tag * tag_u64 (s_tag *tag, u64 x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_u64(tag, x);
-}
-
-s_tag * tag_uw (s_tag *tag, uw x)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_uw(tag, x);
-}
-
-s_tag * tag_var (s_tag *tag)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_var(tag);
-}
-
-s_tag * tag_void (s_tag *tag)
-{
- assert(tag);
- tag_clean(tag);
- return tag_init_void(tag);
-}
-*/
-
bool tag_xor (const s_tag *a, const s_tag *b)
{
s_tag f;
diff --git a/test/buf_parse_test.c b/test/buf_parse_test.c
index f09b9d0..8f3cd5e 100644
--- a/test/buf_parse_test.c
+++ b/test/buf_parse_test.c
@@ -55,10 +55,9 @@
#define BUF_PARSE_TEST_CALL_OP(test) \
do { \
s_buf buf; \
- s_call dest; \
+ s_call dest = {0}; \
test_context("buf_parse_call_op(" # test ")"); \
buf_init_1(&buf, false, (test)); \
- bzero(&dest, sizeof(s_call)); \
TEST_EQ(buf_parse_call_op(&buf, &dest), strlen(test)); \
call_clean(&dest); \
test_context(NULL); \
@@ -281,8 +280,7 @@
#define BUF_PARSE_TEST_NOT_CALL(test) \
do { \
s_buf buf; \
- s_call dest; \
- bzero(&dest, sizeof(dest)); \
+ s_call dest = {0}; \
test_context("buf_parse_call(" # test ") -> 0"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_call(&buf, &dest), 0); \
@@ -293,8 +291,7 @@
#define BUF_PARSE_TEST_NOT_CFN(test) \
do { \
s_buf buf; \
- s_cfn dest; \
- bzero(&dest, sizeof(dest)); \
+ s_cfn dest = {0}; \
test_context("buf_parse_cfn(" # test ") -> 0"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_cfn(&buf, &dest), 0); \
@@ -365,8 +362,7 @@
#define BUF_PARSE_TEST_NOT_IDENT(test) \
do { \
s_buf buf; \
- s_ident dest; \
- bzero(&dest, sizeof(dest)); \
+ s_ident dest = {0}; \
test_context("buf_parse_ident(" # test ") -> 0"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_ident(&buf, &dest), 0); \
@@ -432,8 +428,7 @@
#define BUF_PARSE_TEST_NOT_STR(test) \
do { \
s_buf buf; \
- s_str dest; \
- bzero(&dest, sizeof(dest)); \
+ s_str dest = {0}; \
test_context("buf_parse_str(" # test ") -> 0"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_str(&buf, &dest), 0); \
@@ -467,8 +462,7 @@
#define BUF_PARSE_TEST_STR(test, expected) \
do { \
s_buf buf; \
- s_str dest; \
- bzero(&dest, sizeof(dest)); \
+ s_str dest = {0}; \
test_context("buf_parse_str(" # test ") -> " # expected); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_str(&buf, &dest), strlen(test)); \
@@ -481,8 +475,7 @@
#define BUF_PARSE_TEST_STR_EOF(test) \
do { \
s_buf buf; \
- s_str dest; \
- bzero(&dest, sizeof(dest)); \
+ s_str dest = {0}; \
test_context("buf_parse_str(" # test ") -> EOF"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_str(&buf, &dest), -1); \
@@ -570,8 +563,7 @@
#define BUF_PARSE_TEST_TAG(test) \
do { \
s_buf buf; \
- s_tag dest; \
- bzero(&dest, sizeof(dest)); \
+ s_tag dest = {0}; \
test_context("buf_parse_tag(" # test ")"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_tag(&buf, &dest), strlen(test)); \
@@ -582,8 +574,7 @@
#define BUF_PARSE_TEST_TUPLE(test) \
do { \
s_buf buf; \
- s_tuple dest; \
- bzero(&dest, sizeof(dest)); \
+ s_tuple dest = {0}; \
test_context("buf_parse_tuple(" # test ")"); \
buf_init_1(&buf, false, (test)); \
TEST_EQ(buf_parse_tuple(&buf, &dest), strlen(test)); \
diff --git a/test/str_test.c b/test/str_test.c
index 86ffada..a8e7f04 100644
--- a/test/str_test.c
+++ b/test/str_test.c
@@ -209,8 +209,7 @@ TEST_CASE_END(str_init_copy_1)
TEST_CASE(str_inspect)
{
s_str str;
- s8 zero[16];
- bzero(zero, sizeof(zero));
+ s8 zero[16] = {0};
STR_TEST_INSPECT_1("", "\"\"");
STR_TEST_INSPECT_1(" ", "\" \"");
STR_TEST_INSPECT_1("\n", "\"\\n\"");
@@ -352,8 +351,7 @@ TEST_CASE_END(str_new_f)
TEST_CASE(str_to_hex)
{
- s8 zero[32];
- bzero(zero, sizeof(zero));
+ s8 zero[32] = {0};
STR_TEST_TO_HEX(str_new_1(NULL, ""), "");
STR_TEST_TO_HEX(str_new(NULL, 1, zero), "00");
STR_TEST_TO_HEX(str_new(NULL, 2, zero), "0000");