diff --git a/lib/webfuse/adapter/impl/filesystem.c b/lib/webfuse/adapter/impl/filesystem.c index 4fa1d38..453f67f 100644 --- a/lib/webfuse/adapter/impl/filesystem.c +++ b/lib/webfuse/adapter/impl/filesystem.c @@ -9,8 +9,6 @@ #include "webfuse/adapter/impl/session.h" #include "webfuse/adapter/impl/mountpoint.h" -#include "webfuse/core/string.h" - #include #include diff --git a/lib/webfuse/core/string.c b/lib/webfuse/core/string.c deleted file mode 100644 index 84608cb..0000000 --- a/lib/webfuse/core/string.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "webfuse/core/string.h" - -#include -#include - -char * wf_create_string(char const * format, ...) -{ - char * result = NULL; - - va_list measure_args; - va_start(measure_args, format); - char buffer; - int needed = vsnprintf(&buffer, 1, format, measure_args); - va_end(measure_args); - - if (0 <= needed) - { - result = malloc(needed + 1); - va_list args; - va_start(args, format); - int count = vsnprintf(result, needed + 1, format, args); - va_end(args); - - if ((count < 0) || (needed < count)) - { - free(result); - result = NULL; - } - } - - return result; -} diff --git a/lib/webfuse/core/string.h b/lib/webfuse/core/string.h deleted file mode 100644 index 00a686b..0000000 --- a/lib/webfuse/core/string.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef WF_CORE_STRING_H -#define WF_CORE_STRING_H - -#ifndef __cplusplus -#include -#else -#include -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif - -extern char * wf_create_string(char const * format, ...); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/meson.build b/meson.build index 64bef56..86cef0e 100644 --- a/meson.build +++ b/meson.build @@ -25,7 +25,6 @@ webfuse_core = static_library('webfuse_core', 'lib/webfuse/core/message.c', 'lib/webfuse/core/message_queue.c', 'lib/webfuse/core/status.c', - 'lib/webfuse/core/string.c', 'lib/webfuse/core/base64.c', 'lib/webfuse/core/lws_log.c', 'lib/webfuse/core/json_util.c', @@ -224,7 +223,6 @@ alltests = executable('alltests', 'test/webfuse/mocks/mock_adapter_client_callback.cc', 'test/webfuse//tests/core/test_util.cc', 'test/webfuse/tests/core/test_container_of.cc', - 'test/webfuse/tests/core/test_string.cc', 'test/webfuse/tests/core/test_slist.cc', 'test/webfuse/tests/core/test_base64.cc', 'test/webfuse/tests/core/test_status.cc', diff --git a/test/webfuse/tests/core/test_string.cc b/test/webfuse/tests/core/test_string.cc deleted file mode 100644 index 17e501a..0000000 --- a/test/webfuse/tests/core/test_string.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -#include "webfuse/core/string.h" - -TEST(wf_string_create, Default) -{ - char * value = wf_create_string("test %s/%d", "hello", 42); - ASSERT_STREQ("test hello/42", value); - free(value); -} - -TEST(wf_string_create, EmptyString) -{ - char * value = wf_create_string(""); - ASSERT_STREQ("", value); - free(value); -} diff --git a/test/webfuse/utils/tempdir.cc b/test/webfuse/utils/tempdir.cc index 31dce25..46b78a7 100644 --- a/test/webfuse/utils/tempdir.cc +++ b/test/webfuse/utils/tempdir.cc @@ -1,7 +1,7 @@ -#include "webfuse/core/string.h" #include "webfuse/utils/tempdir.hpp" #include +#include #include #include @@ -9,8 +9,8 @@ namespace webfuse_test { TempDir::TempDir(char const * prefix) -: path_(wf_create_string("/tmp/%s_XXXXXX", prefix)) { + asprintf(&path_, "/tmp/%s_XXXXXX", prefix); char * result = mkdtemp(path_); if (NULL == result) {