Skip to content

Commit 88ba814

Browse files
committed
small improvements
1 parent ed7e8b5 commit 88ba814

File tree

25 files changed

+42
-49
lines changed

25 files changed

+42
-49
lines changed

inc/langdef/langdef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include <cleri/cleri.h>
1414

1515
cleri_grammar_t * compile_langdef(void);
16+
17+
/* TODO: (COMPAT) For compatibility with < v1.5 (old syntax) */
1618
cleri_grammar_t * compile_compat(void);
1719

1820
enum cleri_grammar_ids {

inc/ti/fn/fnbase64encode.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static int do__f_base64_encode(ti_query_t * query, cleri_node_t * nd, ex_t * e)
1313
{
1414
ex_set(e, EX_TYPE_ERROR,
1515
"function `base64_encode` expects argument 1 to be of "
16-
"type `"TI_VAL_STR_S"` or type `"TI_VAL_BYTES_S"` "
16+
"type `"TI_VAL_STR_S"`, `"TI_VAL_BYTES_S"` or `"TI_VAL_MPDATA_S"` "
1717
"but got type `%s` instead"DOC_BASE64_ENCODE,
1818
ti_val_str(query->rval));
1919
return e->nr;

inc/ti/fn/fncopy.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ static int do__f_copy(ti_query_t * query, cleri_node_t * nd, ex_t * e)
55
const char * doc;
66
const int nargs = fn_get_nargs(nd);
77
ti_val_t * val;
8-
uint8_t deep = !(query->rval->tp & 0x4); /* THING/WRAP: 1, ARR/SET: 0 */
8+
/* use deep value of 0 for arr and set, 1 for thing, wrap, wano */
9+
uint8_t deep = !(ti_val_is_arr(query->rval) || ti_val_is_set(query->rval));
910

1011
doc = doc_copy(query->rval);
1112
if (!doc)

inc/ti/fn/fndup.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ static int do__f_dup(ti_query_t * query, cleri_node_t * nd, ex_t * e)
55
const char * doc;
66
const int nargs = fn_get_nargs(nd);
77
ti_val_t * val;
8-
uint8_t deep = !(query->rval->tp & 0x4); /* THING/WRAP: 1, ARR/SET: 0 */
8+
/* use deep value of 0 for arr and set, 1 for thing, wrap, wano */
9+
uint8_t deep = !(ti_val_is_arr(query->rval) || ti_val_is_set(query->rval));
910

1011
doc = doc_dup(query->rval);
1112
if (!doc)

inc/ti/member.t.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct ti_member_s
1717
{
1818
uint32_t ref;
1919
uint8_t tp;
20-
uint8_t unused_flags;
20+
int:8;
2121
uint16_t idx; /* index in enum_->vec */
2222
ti_enum_t * enum_; /* parent enum */
2323
ti_name_t * name; /* with reference */

inc/ti/name.t.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct ti_name_s
1919
{
2020
uint32_t ref;
2121
uint8_t tp;
22-
uint8_t unused_flags;
22+
int:8;
2323
int:16;
2424
uint32_t n;
2525
char str[]; /* null terminated string */

inc/ti/raw.t.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct ti_raw_s
1212
{
1313
uint32_t ref;
1414
uint8_t tp;
15-
uint8_t unused_flags;
15+
int:8;
1616
int:16;
1717
uint32_t n;
1818
unsigned char data[];

inc/ti/room.t.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct ti_room_s
1818
{
1919
uint32_t ref;
2020
uint8_t tp;
21-
uint8_t unused_flags;
21+
int:8;
2222
int:16;
2323
uint64_t id;
2424
ti_name_t * name; /* Name is optional, might be NULL */

inc/ti/spec.t.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ typedef enum
3636
TI_SPEC_ERROR, /* `error` */
3737
TI_SPEC_ROOM, /* `room` */
3838
TI_SPEC_TASK, /* `task` */
39-
TI_SPEC_EMAIL, /* `email */
40-
TI_SPEC_URL, /* `url ` */
41-
TI_SPEC_TEL, /* `tel ` */
39+
TI_SPEC_EMAIL, /* `email` */
40+
TI_SPEC_URL, /* `url` */
41+
TI_SPEC_TEL, /* `tel` */
4242

4343
TI_SPEC_REMATCH=0x5000, /* `/.../` */
4444
TI_SPEC_INT_RANGE, /* `int<:> */

inc/ti/str.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct ti_str_s
1010
{
1111
uint32_t ref;
1212
uint8_t tp;
13-
uint8_t unused_flags;
13+
int:8;
1414
int:16;
1515
uint32_t n;
1616
char str[];

0 commit comments

Comments
 (0)