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
This commit is contained in:
Daniel Stenberg 2023-04-08 00:44:59 +02:00
parent 712e5f1e7f
commit 5f307986a3
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
6 changed files with 1 additions and 99 deletions

View File

@ -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 */

View File

@ -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 <netinet/in.h>
#endif

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: curl
chkdecimalpoint
chkhostname
lib[1234][0-9][0-9][0-9]
lib[56][0-9][0-9]

View File

@ -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")

View File

@ -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 =

View File

@ -1,43 +0,0 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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 <string.h>
#include <locale.h>
#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;
}