From 4bb65cb74329e7b7c1fa7ebbd6f982d5ad8a6dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20K=C3=A4chele?= Date: Tue, 4 Nov 2025 08:15:37 +0100 Subject: [PATCH 1/3] Remove unused token value function --- src/include/token.h | 1 - src/token.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/include/token.h b/src/include/token.h index 5628e2f0d..283cef7a0 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -9,7 +9,6 @@ token_T* token_init(const char* value, token_type_T type, lexer_T* lexer); char* token_to_string(const token_T* token); const char* token_type_to_string(token_type_T type); -char* token_value(const token_T* token); int token_type(const token_T* token); size_t token_sizeof(void); diff --git a/src/token.c b/src/token.c index b6ef42fe8..4d08de5c3 100644 --- a/src/token.c +++ b/src/token.c @@ -119,10 +119,6 @@ char* token_to_string(const token_T* token) { return string; } -char* token_value(const token_T* token) { - return token->value; -} - int token_type(const token_T* token) { return token->type; } From c7f72a6fe9be48fd40162b6149ad3dbfb8ded131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20K=C3=A4chele?= Date: Tue, 4 Nov 2025 08:16:24 +0100 Subject: [PATCH 2/3] Remove unused token_type function --- src/include/token.h | 2 -- src/token.c | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/include/token.h b/src/include/token.h index 283cef7a0..175bfde66 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -9,8 +9,6 @@ token_T* token_init(const char* value, token_type_T type, lexer_T* lexer); char* token_to_string(const token_T* token); const char* token_type_to_string(token_type_T type); -int token_type(const token_T* token); - size_t token_sizeof(void); token_T* token_copy(token_T* token); diff --git a/src/token.c b/src/token.c index 4d08de5c3..5874fc8e2 100644 --- a/src/token.c +++ b/src/token.c @@ -119,10 +119,6 @@ char* token_to_string(const token_T* token) { return string; } -int token_type(const token_T* token) { - return token->type; -} - token_T* token_copy(token_T* token) { if (!token) { return NULL; } From 6bcf740d9a0f4f3bbd7a2b6fb7c15c511e3a384d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20K=C3=A4chele?= Date: Tue, 4 Nov 2025 08:17:43 +0100 Subject: [PATCH 3/3] Remove token_sizeof function --- src/include/token.h | 2 -- src/token.c | 8 ++------ 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/include/token.h b/src/include/token.h index 175bfde66..a91345865 100644 --- a/src/include/token.h +++ b/src/include/token.h @@ -9,8 +9,6 @@ token_T* token_init(const char* value, token_type_T type, lexer_T* lexer); char* token_to_string(const token_T* token); const char* token_type_to_string(token_type_T type); -size_t token_sizeof(void); - token_T* token_copy(token_T* token); void token_free(token_T* token); diff --git a/src/token.c b/src/token.c index 5874fc8e2..dd7b9a76f 100644 --- a/src/token.c +++ b/src/token.c @@ -9,12 +9,8 @@ #include #include -size_t token_sizeof(void) { - return sizeof(struct TOKEN_STRUCT); -} - token_T* token_init(const char* value, const token_type_T type, lexer_T* lexer) { - token_T* token = calloc(1, token_sizeof()); + token_T* token = calloc(1, sizeof(token_T)); if (type == TOKEN_NEWLINE) { lexer->current_line++; @@ -122,7 +118,7 @@ char* token_to_string(const token_T* token) { token_T* token_copy(token_T* token) { if (!token) { return NULL; } - token_T* new_token = calloc(1, token_sizeof()); + token_T* new_token = calloc(1, sizeof(token_T)); if (!new_token) { return NULL; }