From 6447dfb039238c4edeaa7be37a056441de6cba8a Mon Sep 17 00:00:00 2001 From: Brijeshthummar02 Date: Sat, 28 Sep 2024 23:02:11 +0530 Subject: [PATCH 1/4] update benchmark documentation to match code --- docs/benchmark.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/benchmark.md b/docs/benchmark.md index 95fc0de17..54b29179c 100644 --- a/docs/benchmark.md +++ b/docs/benchmark.md @@ -72,14 +72,12 @@ static void CopyElement(benchmark::State& state){ stumpless_set_realloc( copy_element_memory_counter_realloc ); stumpless_set_free( copy_element_memory_counter_free ); - element = stumpless_new_element( "copy-element-perf" ); - stumpless_add_new_param( element, "param-1", "value-1" ); - stumpless_add_new_param( element, "param-2", "value-2" ); + element = create_entry("copy-element-perf"); for(auto _ : state){ result = stumpless_copy_element( element ); if( result <= 0 ) { - state.SkipWithError( "could not send an entry to the target" ); + state.SkipWithError("the element copy failed"); } else { stumpless_destroy_element_and_contents( result ); } From 18d305c1f759f6a3f10ab65a7ac20aae8a200e8e Mon Sep 17 00:00:00 2001 From: Brijeshthummar02 Date: Sun, 29 Sep 2024 10:01:28 +0530 Subject: [PATCH 2/4] remove unused strhelper functions. --- include/private/strhelper.h | 6 ------ src/strhelper.c | 24 ------------------------ tools/check_headers/stumpless.yml | 2 -- 3 files changed, 32 deletions(-) diff --git a/include/private/strhelper.h b/include/private/strhelper.h index 6d44eae82..aea7c75b0 100644 --- a/include/private/strhelper.h +++ b/include/private/strhelper.h @@ -34,12 +34,6 @@ copy_cstring( const char *str ); char * copy_cstring_with_length( const char *str, size_t *length ); -char * -copy_cstring_length( const char *str, size_t length ); - -void -to_upper_case( char *str ); - int strncasecmp_custom( const char *s1, const char *s2, size_t n ); diff --git a/src/strhelper.c b/src/strhelper.c index 6db7d0179..44dde3c49 100644 --- a/src/strhelper.c +++ b/src/strhelper.c @@ -56,30 +56,6 @@ copy_cstring_with_length( const char *str, size_t *length ) { return new_string; } -char * -copy_cstring_length( const char *str, size_t length ) { - char *new_string; - - new_string = alloc_mem( length + 1 ); - if( !new_string ) { - return NULL; - } - - memcpy( new_string, str, length ); - new_string[length] = '\0'; - - return new_string; -} - -void -to_upper_case( char *str ) { - size_t i; - - for( i = 0; str[i]; i++) { - str[i] = toupper( str[i] ); - } -} - int strncasecmp_custom( const char *s1, const char *s2, size_t n ) { if (n != 0) { diff --git a/tools/check_headers/stumpless.yml b/tools/check_headers/stumpless.yml index b048d9db4..e0e6f5bd2 100644 --- a/tools/check_headers/stumpless.yml +++ b/tools/check_headers/stumpless.yml @@ -45,8 +45,6 @@ "copy_cstring_with_length": "private/strhelper.h" "copy_wel_data": "private/config/wel_supported.h" "create_entry": "test/helper/fixture.hpp" -"copy_cstring_length": "private/strhelper.h" -"to_upper_case": "private/strhelper.h" "destroy_buffer_target": "private/target/buffer.h" "destroy_file_target": "private/target/file.h" "destroy_network_target": "private/target/network.h" From 0625da02493951897db72da5c6248c0fc1b90252 Mon Sep 17 00:00:00 2001 From: Brijeshthummar02 Date: Sun, 29 Sep 2024 16:13:36 +0530 Subject: [PATCH 3/4] Static Analysis / custom analysis (pull_request) --- src/strhelper.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/strhelper.c b/src/strhelper.c index 44dde3c49..10bfe5abc 100644 --- a/src/strhelper.c +++ b/src/strhelper.c @@ -16,7 +16,6 @@ * limitations under the License. */ -#include #include #include #include "private/memory.h" From e09062d8228955390923f76a14cc50924b9fbcda Mon Sep 17 00:00:00 2001 From: Brijeshthummar02 Date: Sun, 29 Sep 2024 16:53:10 +0530 Subject: [PATCH 4/4] Add an entry for tolower --- tools/check_headers/c_standard_library.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/check_headers/c_standard_library.yml b/tools/check_headers/c_standard_library.yml index a8c6b558e..691ee0545 100644 --- a/tools/check_headers/c_standard_library.yml +++ b/tools/check_headers/c_standard_library.yml @@ -16,6 +16,7 @@ - "stdlib.h" - "string.h" - "time.h" +"tolower": "ctype.h" "true": "stdbool.h" "va_end": "stdarg.h" "va_list": "stdarg.h"