diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a0e7926..2a04d6f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Rename change._tasks in C code, no user impact. * Replaced Docker images _(both tests and builds)_ with newer versions. * Removed `ti_pkg_check` hack for old compilers _(no longer required with recent compilers)_. +* Added `INT_MIN` and `INT_MAX` fixed keywords with corresponding values. # v1.4.16 diff --git a/inc/ti/fn/fnnewbackup.h b/inc/ti/fn/fnnewbackup.h index 3241ff73..f82161b7 100644 --- a/inc/ti/fn/fnnewbackup.h +++ b/inc/ti/fn/fnnewbackup.h @@ -28,6 +28,9 @@ static int do__f_new_backup(ti_query_t * query, cleri_node_t * nd, ex_t * e) if (!ti_raw_endswith(rname, tar_gz_str)) { + /* The ti_backup_is_gcloud() function depends on a filename size of at + * least 5 characters, this ensures 7 characters; + */ ex_set(e, EX_VALUE_ERROR, "expecting a backup file-name to end with `%.*s`" DOC_NEW_BACKUP, tar_gz_str->n, (char *) tar_gz_str->data); diff --git a/inc/ti/forloop.h b/inc/ti/forloop.h index 8b4218e3..f800c08f 100644 --- a/inc/ti/forloop.h +++ b/inc/ti/forloop.h @@ -39,7 +39,7 @@ typedef int (*ti_forloop_t) ( cleri_node_t *, ex_t *); -static ti_forloop_t ti_forloop_callbacks[21] = { +static const ti_forloop_t ti_forloop_callbacks[21] = { ti_forloop_no_iter, /* TI_VAL_NIL */ ti_forloop_no_iter, /* TI_VAL_INT */ ti_forloop_no_iter, /* TI_VAL_FLOAT */ diff --git a/inc/ti/val.t.h b/inc/ti/val.t.h index 225b636a..1d2a3b9d 100644 --- a/inc/ti/val.t.h +++ b/inc/ti/val.t.h @@ -42,6 +42,7 @@ * Both copy() and dup() use the following code to set the default deep value: * !(type & 0x4); THING/WRAP: 1 ARR/SET: 0 * Be careful when changing the order in the enumerator. + * The ti_forloop_t also depends on the order in this enumerator; */ typedef enum { diff --git a/inc/ti/version.h b/inc/ti/version.h index 34dc2f6c..00e9f6f7 100644 --- a/inc/ti/version.h +++ b/inc/ti/version.h @@ -25,7 +25,7 @@ * "-rc0" * "" */ -#define TI_VERSION_PRE_RELEASE "-alpha4" +#define TI_VERSION_PRE_RELEASE "-alpha5" #define TI_MAINTAINER \ "Jeroen van der Heijden " diff --git a/main.c b/main.c index 36d6f36c..525f4996 100644 --- a/main.c +++ b/main.c @@ -3,7 +3,7 @@ * * author/maintainer : Jeroen van der Heijden * home page : https://thingsdb.net - * copyright : 2021, Jeroen van der Heijden + * copyright : 2024, Jeroen van der Heijden * * This code will be release as open source but the exact license might be * changed to something else than MIT. diff --git a/src/ti/backup.c b/src/ti/backup.c index 61c65712..3c342be9 100644 --- a/src/ti/backup.c +++ b/src/ti/backup.c @@ -158,7 +158,10 @@ ti_val_t * ti_backup_as_mpval(ti_backup_t * backup) _Bool ti_backup_is_gcloud(ti_backup_t * backup) { char * s = backup->fn_template; - + /* + * This check depends on the test that each backup file ends + * with ".tar.gz" and therefore must have a length of at least seven; + */ return s[0] == 'g' && s[1] == 's' && s[2] == ':' && diff --git a/src/ti/do.c b/src/ti/do.c index f6a732e5..f68a575f 100644 --- a/src/ti/do.c +++ b/src/ti/do.c @@ -860,11 +860,11 @@ int ti_do_closure(ti_query_t * query, cleri_node_t * nd, ex_t * e) enum { - TOTAL_KEYWORDS = 13, + TOTAL_KEYWORDS = 15, MIN_WORD_LENGTH = 3, MAX_WORD_LENGTH = 8, MIN_HASH_VALUE = 3, - MAX_HASH_VALUE = 15 + MAX_HASH_VALUE = 17 }; static inline unsigned int do__hash( @@ -873,32 +873,32 @@ static inline unsigned int do__hash( { static unsigned char asso_values[] = { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 1, 5, 1, 4, 0, - 3, 1, 3, 0, 5, 16, 2, 16, 0, 1, - 16, 0, 0, 0, 0, 0, 16, 0, 16, 0, - 16, 16, 16, 16, 16, 3, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16 + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 2, 2, 2, 9, 0, + 6, 1, 3, 0, 8, 18, 1, 0, 0, 1, + 18, 0, 0, 0, 0, 0, 18, 0, 0, 0, + 18, 18, 18, 18, 18, 0, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18 }; register unsigned int hval = n; @@ -937,7 +937,7 @@ static inline unsigned int do__hash( typedef struct { char name[MAX_WORD_LENGTH+1]; - int value; + int64_t value; ti_val_t * val; size_t n; } do__fixed_t; @@ -956,6 +956,8 @@ do__fixed_t do__fixed_mapping[TOTAL_KEYWORDS] = { {.name="ERROR", .value=LOGGER_ERROR}, {.name="CRITICAL", .value=LOGGER_CRITICAL}, {.name="NO_IDS", .value=TI_FLAGS_NO_IDS}, + {.name="INT_MIN", .value=LLONG_MIN}, + {.name="INT_MAX", .value=LLONG_MAX}, }; static do__fixed_t * do__fixed_map[MAX_HASH_VALUE+1];