]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/server: move memory init to `memptr.c`
authorViktor Szakats <commit@vsz.me>
Tue, 24 Jun 2025 14:42:17 +0000 (16:42 +0200)
committerViktor Szakats <commit@vsz.me>
Tue, 24 Jun 2025 23:37:56 +0000 (01:37 +0200)
To sync with tests/libtest.

Closes #17735

tests/server/Makefile.inc
tests/server/getpart.c
tests/server/memptr.c [new file with mode: 0644]

index 82916744b8b1e94133f59e553cdf150c4fc1f327..b21f7a5799952b82f4bf337f756ca0336a29dc69 100644 (file)
@@ -29,7 +29,7 @@ BUNDLE = servers
 FIRSTFILES = first.c first.h
 
 # Common files used by test programs
-UTILS = getpart.c util.c
+UTILS = memptr.c getpart.c util.c
 
 CURLX_CFILES = \
   ../../lib/curlx/base64.c \
index 8725f540b37915ce4ad0d66c5834c62100b7f734..58ced8a45b32cb0e7ffb61580b77c7f8f3e39bec 100644 (file)
 #define show(x) Curl_nop_stmt
 #endif
 
-#if defined(UNDER_CE)
-#define system_strdup _strdup
-#else
-#define system_strdup strdup
-#endif
-
-#include "curl_memory.h"
-
-#if defined(_MSC_VER) && defined(_DLL)
-#  pragma warning(push)
-#  pragma warning(disable:4232) /* MSVC extension, dllimport identity */
-#endif
-
-curl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc;
-curl_free_callback Curl_cfree = (curl_free_callback)free;
-curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
-curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup;
-curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
-#if defined(_WIN32) && defined(UNICODE)
-curl_wcsdup_callback Curl_cwcsdup = NULL; /* not use in test code */
-#endif
-
-#if defined(_MSC_VER) && defined(_DLL)
-#  pragma warning(pop)
-#endif
-
 /*
  * line_length()
  *
diff --git a/tests/server/memptr.c b/tests/server/memptr.c
new file mode 100644 (file)
index 0000000..96187e5
--- /dev/null
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *                                  _   _ ____  _
+ *  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 "first.h"
+
+#include "curl_memory.h"
+
+#ifdef UNDER_CE
+#define system_strdup _strdup
+#else
+#define system_strdup strdup
+#endif
+
+#if defined(_MSC_VER) && defined(_DLL)
+#  pragma warning(push)
+#  pragma warning(disable:4232) /* MSVC extension, dllimport identity */
+#endif
+
+curl_malloc_callback Curl_cmalloc = (curl_malloc_callback)malloc;
+curl_free_callback Curl_cfree = (curl_free_callback)free;
+curl_realloc_callback Curl_crealloc = (curl_realloc_callback)realloc;
+curl_strdup_callback Curl_cstrdup = (curl_strdup_callback)system_strdup;
+curl_calloc_callback Curl_ccalloc = (curl_calloc_callback)calloc;
+#if defined(_WIN32) && defined(UNICODE)
+curl_wcsdup_callback Curl_cwcsdup = NULL; /* not used in test code */
+#endif
+
+#if defined(_MSC_VER) && defined(_DLL)
+#  pragma warning(pop)
+#endif