From e39d7a06e461c5731dc0529dfa3240a2f5f1c13e Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 9 Feb 2026 22:19:29 +0100 Subject: [PATCH] Remove sc_str_quote() It is no longer used. PR #6663 --- app/src/util/str.c | 15 --------------- app/src/util/str.h | 8 -------- app/tests/test_str.c | 11 ----------- 3 files changed, 34 deletions(-) diff --git a/app/src/util/str.c b/app/src/util/str.c index 83d19c4d..c4f04b55 100644 --- a/app/src/util/str.c +++ b/app/src/util/str.c @@ -49,21 +49,6 @@ truncated: return n; } -char * -sc_str_quote(const char *src) { - size_t len = strlen(src); - char *quoted = malloc(len + 3); - if (!quoted) { - LOG_OOM(); - return NULL; - } - memcpy("ed[1], src, len); - quoted[0] = '"'; - quoted[len + 1] = '"'; - quoted[len + 2] = '\0'; - return quoted; -} - char * sc_str_concat(const char *start, const char *end) { assert(start); diff --git a/app/src/util/str.h b/app/src/util/str.h index b386b48d..b48e6334 100644 --- a/app/src/util/str.h +++ b/app/src/util/str.h @@ -32,14 +32,6 @@ sc_strncpy(char *dest, const char *src, size_t n); size_t sc_str_join(char *dst, const char *const tokens[], char sep, size_t n); -/** - * Quote a string - * - * Return a new allocated string, surrounded with quotes (`"`). - */ -char * -sc_str_quote(const char *src); - /** * Concat two strings * diff --git a/app/tests/test_str.c b/app/tests/test_str.c index 4a906d92..49cf12d5 100644 --- a/app/tests/test_str.c +++ b/app/tests/test_str.c @@ -131,16 +131,6 @@ static void test_join_truncated_after_sep(void) { assert(!strcmp("abc de ", s)); } -static void test_quote(void) { - const char *s = "abcde"; - char *out = sc_str_quote(s); - - // add '"' at the beginning and the end - assert(!strcmp("\"abcde\"", out)); - - free(out); -} - static void test_concat(void) { const char *s = "2024:11"; char *out = sc_str_concat("my-prefix:", s); @@ -398,7 +388,6 @@ int main(int argc, char *argv[]) { test_join_truncated_in_token(); test_join_truncated_before_sep(); test_join_truncated_after_sep(); - test_quote(); test_concat(); test_utf8_truncate(); test_parse_integer();