1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

curl tool: re-enable MemoryTracking capability on 'src' subdirectory files.

Use same preprocessor logic for curl tool MemoryTracking activation in source
files located in 'src' subdirectory as the one used for libcurl sources.
This commit is contained in:
Yang Tse 2011-09-14 11:27:12 +02:00
parent 0216e517d0
commit 90080da5fe
20 changed files with 88 additions and 89 deletions

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -19,11 +19,12 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#include "curlutil.h" #include "curlutil.h"
#include "memdebug.h" /* keep this as LAST include */
#if defined(WIN32) && !defined(MSDOS) #if defined(WIN32) && !defined(MSDOS)
struct timeval cutil_tvnow(void) struct timeval cutil_tvnow(void)

View File

@ -1,5 +1,5 @@
#ifndef __CURL_SRC_UTIL_H #ifndef HEADER_CURL_SRC_UTIL_H
#define __CURL_SRC_UTIL_H #define HEADER_CURL_SRC_UTIL_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,7 +21,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
@ -45,5 +44,5 @@ double cutil_tvdiff_secs(struct timeval t1, struct timeval t2);
long cutil_tvlong(struct timeval t1); long cutil_tvlong(struct timeval t1);
#endif /* __CURL_SRC_UTIL_H */ #endif /* HEADER_CURL_SRC_UTIL_H */

View File

@ -19,10 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
/* This file is a reimplementation of the previous one, due to license
problems. */
#include "setup.h" #include "setup.h"
#ifndef HAVE_GETPASS_R #ifndef HAVE_GETPASS_R
@ -32,8 +28,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "getpass.h"
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#endif #endif
@ -45,17 +39,30 @@
#endif #endif
#endif #endif
/* The last #include file should be: */ #ifdef __VMS
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) # include descrip
#include "memdebug.h" # include starlet
# include iodef
#endif #endif
#ifdef WIN32
# include <conio.h>
#endif
#ifdef NETWARE
# ifdef __NOVELL_LIBC__
# include <screen.h>
# else
# include <nwconio.h>
# endif
#endif
#include "getpass.h"
#include "memdebug.h" /* keep this as LAST include */
#ifdef __VMS #ifdef __VMS
/* VMS implementation */ /* VMS implementation */
#include descrip
#include starlet
#include iodef
/* #include iosbdef */
char *getpass_r(const char *prompt, char *buffer, size_t buflen) char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{ {
long sts; long sts;
@ -91,12 +98,6 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#define DONE #define DONE
#endif /* __VMS */ #endif /* __VMS */
#ifdef WIN32
/* Windows implementation */
#include <conio.h>
#endif
#ifdef __SYMBIAN32__ #ifdef __SYMBIAN32__
#define getch() getchar() #define getch() getchar()
#endif #endif
@ -136,13 +137,11 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#ifdef NETWARE #ifdef NETWARE
/* NetWare implementation */ /* NetWare implementation */
#ifdef __NOVELL_LIBC__ #ifdef __NOVELL_LIBC__
#include <screen.h>
char *getpass_r(const char *prompt, char *buffer, size_t buflen) char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{ {
return getpassword(prompt, buffer, buflen); return getpassword(prompt, buffer, buflen);
} }
#else #else
#include <nwconio.h>
char *getpass_r(const char *prompt, char *buffer, size_t buflen) char *getpass_r(const char *prompt, char *buffer, size_t buflen)
{ {
size_t i = 0; size_t i = 0;

View File

@ -1,5 +1,5 @@
#ifndef __GETPASS_H #ifndef HEADER_CURL_GETPASS_H
#define __GETPASS_H #define HEADER_CURL_GETPASS_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,8 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
#ifndef HAVE_GETPASS_R #ifndef HAVE_GETPASS_R
/* If there's a system-provided function named like this, we trust it is /* If there's a system-provided function named like this, we trust it is
also found in one of the standard headers. */ also found in one of the standard headers. */
@ -31,4 +33,4 @@
char* getpass_r(const char *prompt, char* buffer, size_t buflen ); char* getpass_r(const char *prompt, char* buffer, size_t buflen );
#endif #endif
#endif #endif /* HEADER_CURL_GETPASS_H */

View File

@ -19,7 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#ifdef HAVE_PWD_H #ifdef HAVE_PWD_H
@ -34,9 +33,7 @@
#include "homedir.h" #include "homedir.h"
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) #include "memdebug.h" /* keep this as LAST include */
#include "memdebug.h"
#endif
static static
char *GetEnv(const char *variable, char do_expand) char *GetEnv(const char *variable, char do_expand)

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
char *homedir(void); char *homedir(void);

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,8 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
void hugehelp(void); void hugehelp(void);
#endif /* HEADER_CURL_HUGEHELP_H */ #endif /* HEADER_CURL_HUGEHELP_H */

View File

@ -19,7 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#include <curl/curl.h> #include <curl/curl.h>
@ -138,16 +137,10 @@
versions instead */ versions instead */
#include "curlx.h" #include "curlx.h"
/* The last #include file should be: */
#ifdef CURLDEBUG
#ifndef CURLTOOLDEBUG
#define MEMDEBUG_NODEFINES
#endif
/* This is low-level hard-hacking memory leak tracking and similar. Using /* This is low-level hard-hacking memory leak tracking and similar. Using
the library level code from this client-side is ugly, but we do this the library level code from this client-side is ugly, but we do this
anyway for convenience. */ anyway for convenience. */
#include "memdebug.h" #include "memdebug.h" /* keep this as LAST include */
#endif
#ifdef __VMS #ifdef __VMS
static int vms_show = 0; static int vms_show = 0;

View File

@ -140,9 +140,7 @@ HEAD
if($c) { if($c) {
print <<HEAD print <<HEAD
#include <zlib.h> #include <zlib.h>
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) #include "memdebug.h" /* keep this as LAST include */
#include "memdebug.h"
#endif
static const unsigned char hugehelpgz[] = { static const unsigned char hugehelpgz[] = {
/* This mumbo-jumbo is the huge help text compressed with gzip. /* This mumbo-jumbo is the huge help text compressed with gzip.
Thanks to this operation, the size of this data shrunk from $gzip Thanks to this operation, the size of this data shrunk from $gzip

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,20 +21,22 @@
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#ifdef __VMS
#if defined(__DECC) && !defined(__VAX) && \
defined(__CRTL_VER) && (__CRTL_VER >= 70301000)
#include <unixlib.h>
#endif
#include <curl/curl.h> #include <curl/curl.h>
#define ENABLE_CURLX_PRINTF #define ENABLE_CURLX_PRINTF
#include "curlx.h" #include "curlx.h"
#include "curlmsg_vms.h"
#include "os-specific.h" #include "os-specific.h"
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) #include "memdebug.h" /* keep this as LAST include */
# include "memdebug.h"
#endif
#ifdef __VMS
#include "curlmsg_vms.h"
void decc$__posix_exit(int __status); void decc$__posix_exit(int __status);
void decc$exit(int __status); void decc$exit(int __status);
@ -121,8 +123,6 @@ void vms_special_exit(int code, int vms_show)
* requiring the user to define the corresponding logical names. * requiring the user to define the corresponding logical names.
*/ */
#include <unixlib.h>
/* Structure to hold a DECC$* feature name and its desired value. */ /* Structure to hold a DECC$* feature name and its desired value. */
typedef struct { typedef struct {
char *name; char *name;

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
#ifdef __VMS #ifdef __VMS

View File

@ -19,8 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
/* client-local setup.h */
#include "setup.h" #include "setup.h"
#include <curl/curl.h> #include <curl/curl.h>
@ -31,9 +29,7 @@
#include "urlglob.h" #include "urlglob.h"
#include "os-specific.h" #include "os-specific.h"
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) #include "memdebug.h" /* keep this as LAST include */
#include "memdebug.h"
#endif
typedef enum { typedef enum {
GLOB_OK, GLOB_OK,

View File

@ -1,5 +1,5 @@
#ifndef __URLGLOB_H #ifndef HEADER_CURL_URLGLOB_H
#define __URLGLOB_H #define HEADER_CURL_URLGLOB_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,8 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
typedef enum { typedef enum {
UPTSet=1, UPTSet=1,
UPTCharRange, UPTCharRange,
@ -64,4 +66,4 @@ char* glob_next_url(URLGlob*);
char* glob_match_url(char*, URLGlob *); char* glob_match_url(char*, URLGlob *);
void glob_cleanup(URLGlob* glob); void glob_cleanup(URLGlob* glob);
#endif #endif /* HEADER_CURL_URLGLOB_H */

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
#include <curl/curlver.h> #include <curl/curlver.h>

View File

@ -19,24 +19,22 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#ifdef USE_ENVIRONMENT #ifdef USE_ENVIRONMENT
#include <curl/curl.h>
#include "writeenv.h"
#ifdef __riscos__ #ifdef __riscos__
#include <kernel.h> #include <kernel.h>
#endif #endif
#include <curl/curl.h>
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
#if defined(CURLDEBUG) && defined(CURLTOOLDEBUG) #include "writeenv.h"
#include "memdebug.h"
#endif #include "memdebug.h" /* keep this as LAST include */
static const struct static const struct
{ {

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
void ourWriteEnv(CURL *curl); void ourWriteEnv(CURL *curl);

View File

@ -19,7 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h" #include "setup.h"
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
@ -36,6 +35,8 @@
#include "writeout.h" #include "writeout.h"
#include "memdebug.h" /* keep this as LAST include */
typedef enum { typedef enum {
VAR_NONE, /* must be the first */ VAR_NONE, /* must be the first */
VAR_TOTAL_TIME, VAR_TOTAL_TIME,

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
void ourWriteOut(CURL *curl, const char *out); void ourWriteOut(CURL *curl, const char *out);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2010, 2011, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -19,15 +19,19 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
/* client-local setup.h */
#include "setup.h" #include "setup.h"
#include <curl/curl.h>
#include "xattr.h"
#ifdef HAVE_FSETXATTR #ifdef HAVE_FSETXATTR
#include <sys/types.h> #include <sys/types.h>
#include <sys/xattr.h> /* include header from libc, not from libattr */ #include <sys/xattr.h> /* include header from libc, not from libattr */
#endif
#include <curl/curl.h>
#include "xattr.h"
#include "memdebug.h" /* keep this as LAST include */
#ifdef HAVE_FSETXATTR
/* mapping table of curl metadata to extended attribute names */ /* mapping table of curl metadata to extended attribute names */
static const struct xattr_mapping { static const struct xattr_mapping {

View File

@ -1,5 +1,5 @@
#ifndef __XATTR_H #ifndef HEADER_CURL_XATTR_H
#define __XATTR_H #define HEADER_CURL_XATTR_H
/*************************************************************************** /***************************************************************************
* _ _ ____ _ * _ _ ____ _
* Project ___| | | | _ \| | * Project ___| | | | _ \| |
@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@ -21,6 +21,8 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
***************************************************************************/ ***************************************************************************/
#include "setup.h"
int fwrite_xattr(CURL *curl, int fd); int fwrite_xattr(CURL *curl, int fd);
#endif #endif /* HEADER_CURL_XATTR_H */