diff --git a/base/sources/libs/kong/functions.c b/base/sources/libs/kong/functions.c index a400296e..cb2a3451 100644 --- a/base/sources/libs/kong/functions.c +++ b/base/sources/libs/kong/functions.c @@ -7,7 +7,11 @@ #include static function *functions = NULL; -static function_id functions_size = 1024; +//// +// static function_id functions_size = 1024; +static function_id functions_size = 128; +//// + //// // static function_id next_function_index = 0; function_id next_function_index = 0; diff --git a/base/sources/libs/kong/names.c b/base/sources/libs/kong/names.c index 6d817659..c8005c3d 100644 --- a/base/sources/libs/kong/names.c +++ b/base/sources/libs/kong/names.c @@ -13,7 +13,10 @@ static size_t names_size = 1024 * 1024; name_id names_index = 1; //// -static struct { +//// +// static struct { +struct { +//// char *key; name_id value; } *hash = NULL; diff --git a/base/sources/libs/kong/parser.c b/base/sources/libs/kong/parser.c index 7333a693..a98e8b6b 100644 --- a/base/sources/libs/kong/parser.c +++ b/base/sources/libs/kong/parser.c @@ -9,8 +9,17 @@ #include #include +//// +static statement statements_buffer[2048]; +int statement_index = 0; +//// + static statement *statement_allocate(void) { - statement *s = (statement *)malloc(sizeof(statement)); + //// + // statement *s = (statement *)malloc(sizeof(statement)); + statement *s = &statements_buffer[statement_index]; + statement_index++; + //// debug_context context = {0}; check(s != NULL, context, "Could not allocate statement"); return s; @@ -29,8 +38,17 @@ static void statements_add(statements *statements, statement *statement) { statements->size += 1; } +//// +static expression experessions_buffer[2048]; +int expression_index = 0; +//// + static expression *expression_allocate(void) { - expression *e = (expression *)malloc(sizeof(expression)); + //// + //expression *e = (expression *)malloc(sizeof(expression)); + expression *e = &experessions_buffer[expression_index]; + expression_index++; + //// debug_context context = {0}; check(e != NULL, context, "Could not allocate expression"); init_type_ref(&e->type, NO_NAME); diff --git a/base/sources/libs/kong/tokenizer.c b/base/sources/libs/kong/tokenizer.c index 5051bfcf..e0747dce 100644 --- a/base/sources/libs/kong/tokenizer.c +++ b/base/sources/libs/kong/tokenizer.c @@ -244,6 +244,9 @@ tokens tokenize(const char *filename, const char *source) { } tokens_add(&tokens, token_create(TOKEN_NONE, &state)); + //// + free(buffer.buf); + //// return tokens; } else {