From 5f307986a39309c5ab5c4f775ce947ca7bb86139 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 8 Apr 2023 00:44:59 +0200 Subject: lib: remove CURLX_NO_MEMORY_CALLBACKS The only user of this define was 'chkdecimalpoint' - a special purpose test tool that was built but not used anymore (since 17c18fbc3 - Apr 2020). Closes #10908 --- lib/curl_memory.h | 36 ---------------------------------- lib/easy.c | 8 -------- tests/libtest/.gitignore | 1 - tests/libtest/CMakeLists.txt | 3 --- tests/libtest/Makefile.inc | 9 +-------- tests/libtest/chkdecimalpoint.c | 43 ----------------------------------------- 6 files changed, 1 insertion(+), 99 deletions(-) delete mode 100644 tests/libtest/chkdecimalpoint.c diff --git a/lib/curl_memory.h b/lib/curl_memory.h index 7af139196..1a21c5ad4 100644 --- a/lib/curl_memory.h +++ b/lib/curl_memory.h @@ -52,39 +52,12 @@ * mentioned above will compile without any indication, but it will * trigger weird memory related issues at runtime. * - * OTOH some source files from 'lib' subdirectory may additionally be - * used directly as source code when using some curlx_ functions by - * third party programs that don't even use libcurl at all. When using - * these source files in this way it is necessary these are compiled - * with CURLX_NO_MEMORY_CALLBACKS defined, in order to ensure that no - * attempt of calling libcurl's memory callbacks is done from code - * which can not use this machinery. - * - * Notice that libcurl's 'memory tracking' system works chaining into - * the memory callback machinery. This implies that when compiling - * 'lib' source files with CURLX_NO_MEMORY_CALLBACKS defined this file - * disengages usage of libcurl's 'memory tracking' system, defining - * MEMDEBUG_NODEFINES and overriding CURLDEBUG purpose. - * - * CURLX_NO_MEMORY_CALLBACKS takes precedence over CURLDEBUG. This is - * done in order to allow building a 'memory tracking' enabled libcurl - * and at the same time allow building programs which do not use it. - * - * Programs and libraries in 'tests' subdirectories have specific - * purposes and needs, and as such each one will use whatever fits - * best, depending additionally whether it links with libcurl or not. - * - * Caveat emptor. Proper curlx_* separation is a work in progress - * the same as CURLX_NO_MEMORY_CALLBACKS usage, some adjustments may - * still be required. IOW don't use them yet, there are sharp edges. */ #ifdef HEADER_CURL_MEMDEBUG_H #error "Header memdebug.h shall not be included before curl_memory.h" #endif -#ifndef CURLX_NO_MEMORY_CALLBACKS - #ifndef CURL_DID_MEMORY_FUNC_TYPEDEFS /* only if not already done */ /* * The following memory function replacement typedef's are COPIED from @@ -146,13 +119,4 @@ extern curl_wcsdup_callback Curl_cwcsdup; #endif #endif /* CURLDEBUG */ - -#else /* CURLX_NO_MEMORY_CALLBACKS */ - -#ifndef MEMDEBUG_NODEFINES -#define MEMDEBUG_NODEFINES -#endif - -#endif /* CURLX_NO_MEMORY_CALLBACKS */ - #endif /* HEADER_CURL_MEMORY_H */ diff --git a/lib/easy.c b/lib/easy.c index 27124a72f..f3581410d 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -24,14 +24,6 @@ #include "curl_setup.h" -/* - * See comment in curl_memory.h for the explanation of this sanity check. - */ - -#ifdef CURLX_NO_MEMORY_CALLBACKS -#error "libcurl shall not ever be built with CURLX_NO_MEMORY_CALLBACKS defined" -#endif - #ifdef HAVE_NETINET_IN_H #include #endif diff --git a/tests/libtest/.gitignore b/tests/libtest/.gitignore index 3e36c15b8..9541d16e1 100644 --- a/tests/libtest/.gitignore +++ b/tests/libtest/.gitignore @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: curl -chkdecimalpoint chkhostname lib[1234][0-9][0-9][0-9] lib[56][0-9][0-9] diff --git a/tests/libtest/CMakeLists.txt b/tests/libtest/CMakeLists.txt index 412e5e9a7..30e351055 100644 --- a/tests/libtest/CMakeLists.txt +++ b/tests/libtest/CMakeLists.txt @@ -80,6 +80,3 @@ add_custom_command( "${CMAKE_CURRENT_SOURCE_DIR}/mk-lib1521.pl" "${CURL_SOURCE_DIR}/include/curl/curl.h" VERBATIM) - -set_property(TARGET chkdecimalpoint - APPEND PROPERTY COMPILE_DEFINITIONS "CURLX_NO_MEMORY_CALLBACKS;CURL_STATICLIB") diff --git a/tests/libtest/Makefile.inc b/tests/libtest/Makefile.inc index c8eb4149c..75d711a35 100644 --- a/tests/libtest/Makefile.inc +++ b/tests/libtest/Makefile.inc @@ -37,8 +37,7 @@ MULTIBYTE = ../../lib/curl_multibyte.c ../../lib/curl_multibyte.h SUPPORTFILES = ../../lib/timediff.c ../../lib/timediff.h first.c test.h # These are all libcurl test programs -noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \ - chkdecimalpoint libprereq \ +noinst_PROGRAMS = chkhostname libauthretry libntlmconnect libprereq \ lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509 \ lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519 \ lib520 lib521 lib523 lib524 lib525 lib526 lib527 lib529 lib530 lib532 \ @@ -77,12 +76,6 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \ lib3010 lib3025 lib3026 lib3027 \ lib3100 lib3101 -chkdecimalpoint_SOURCES = chkdecimalpoint.c ../../lib/mprintf.c \ - ../../lib/dynbuf.c ../../lib/strdup.c -chkdecimalpoint_LDADD = -chkdecimalpoint_CPPFLAGS = $(AM_CPPFLAGS) -DCURL_STATICLIB \ - -DCURLX_NO_MEMORY_CALLBACKS -DBUILDING_LIBCURL - chkhostname_SOURCES = chkhostname.c ../../lib/curl_gethostname.c chkhostname_LDADD = @CURL_NETWORK_LIBS@ chkhostname_DEPENDENCIES = diff --git a/tests/libtest/chkdecimalpoint.c b/tests/libtest/chkdecimalpoint.c deleted file mode 100644 index 5e201fa02..000000000 --- a/tests/libtest/chkdecimalpoint.c +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at https://curl.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * SPDX-License-Identifier: curl - * - ***************************************************************************/ - -#include "curl_printf.h" - -#include -#include - -#define TOTAL_STR_LEN 4 - -int main(void) -{ - char zero[TOTAL_STR_LEN] = {'\0'}; - int chars; - - setlocale(LC_NUMERIC, ""); - chars = msnprintf(zero, TOTAL_STR_LEN, "%.1f", 0.0); - if((chars == (TOTAL_STR_LEN - 1)) && (strcmp(zero, "0.0") == 0)) - return 0; - else - return 1; -} -- cgit v1.2.1