mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Use Gnulib's alloc functions throughout the source.
This commit is contained in:
parent
b06220f359
commit
76780021d8
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -43,6 +43,8 @@ as that of the covered work. */
|
|||||||
sites that do send Set-Cookie2 also emit Set-Cookie for
|
sites that do send Set-Cookie2 also emit Set-Cookie for
|
||||||
compatibility. */
|
compatibility. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include "gen-md5.h"
|
#include "gen-md5.h"
|
||||||
|
@ -27,6 +27,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -31,6 +31,8 @@ as that of the covered work. */
|
|||||||
/* With -DSTANDALONE, this file can be compiled outside Wget source
|
/* With -DSTANDALONE, this file can be compiled outside Wget source
|
||||||
tree. To test, also use -DTEST. */
|
tree. To test, also use -DTEST. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#ifndef STANDALONE
|
#ifndef STANDALONE
|
||||||
# include "wget.h"
|
# include "wget.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -89,6 +89,8 @@ as that of the covered work. */
|
|||||||
/* To test as standalone, compile with `-DSTANDALONE -I.'. You'll
|
/* To test as standalone, compile with `-DSTANDALONE -I.'. You'll
|
||||||
still need Wget headers to compile. */
|
still need Wget headers to compile. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
@ -100,6 +102,7 @@ as that of the covered work. */
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
#include "html-parse.h"
|
#include "html-parse.h"
|
||||||
|
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
/* NTLM details:
|
/* NTLM details:
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#define INHIBIT_WRAP /* avoid wrapping of socket, bind, ... */
|
#define INHIBIT_WRAP /* avoid wrapping of socket, bind, ... */
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
@ -30,6 +30,8 @@ as that of the covered work. */
|
|||||||
/* This file used to be kept in synch with the code in Fetchmail, but
|
/* This file used to be kept in synch with the code in Fetchmail, but
|
||||||
the latter has diverged since. */
|
the latter has diverged since. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -29,6 +29,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -50,6 +50,8 @@ as that of the covered work. */
|
|||||||
double secs = ptimer_measure ();
|
double secs = ptimer_measure ();
|
||||||
printf ("The loop took %.2fs\n", secs); */
|
printf ("The loop took %.2fs\n", secs); */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -71,6 +73,7 @@ as that of the covered work. */
|
|||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
#include "ptimer.h"
|
#include "ptimer.h"
|
||||||
|
|
||||||
/* Depending on the OS, one and only one of PTIMER_POSIX,
|
/* Depending on the OS, one and only one of PTIMER_POSIX,
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -67,6 +67,8 @@ as that of the covered work. */
|
|||||||
res_match_path, res_register_specs, res_get_specs, and
|
res_match_path, res_register_specs, res_get_specs, and
|
||||||
res_retrieve_file. */
|
res_retrieve_file. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -87,6 +87,8 @@
|
|||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,6 +27,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -27,6 +27,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -28,6 +28,8 @@ Corresponding Source for a non-source form of such a combination
|
|||||||
shall include the source code for the parts of OpenSSL used as well
|
shall include the source code for the parts of OpenSSL used as well
|
||||||
as that of the covered work. */
|
as that of the covered work. */
|
||||||
|
|
||||||
|
#define USE_GNULIB_ALLOC
|
||||||
|
|
||||||
#include "wget.h"
|
#include "wget.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
26
src/utils.h
26
src/utils.h
@ -31,6 +31,32 @@ as that of the covered work. */
|
|||||||
#ifndef UTILS_H
|
#ifndef UTILS_H
|
||||||
#define UTILS_H
|
#define UTILS_H
|
||||||
|
|
||||||
|
#ifdef USE_GNULIB_ALLOC
|
||||||
|
|
||||||
|
/* Constant is using when we don`t know attempted size exactly */
|
||||||
|
#define UNKNOWN_ATTEMPTED_SIZE -3
|
||||||
|
|
||||||
|
/* Macros that interface to malloc, but know about type sizes, and
|
||||||
|
cast the result to the appropriate type. The casts are not
|
||||||
|
necessary in standard C, but Wget performs them anyway for the sake
|
||||||
|
of pre-standard environments and possibly C++. */
|
||||||
|
|
||||||
|
#define xnew(type) (xmalloc (sizeof (type)))
|
||||||
|
#define xnew0(type) (xcalloc (1, sizeof (type)))
|
||||||
|
#define xnew_array(type, len) (xmalloc ((len) * sizeof (type)))
|
||||||
|
#define xnew0_array(type, len) (xcalloc ((len), sizeof (type)))
|
||||||
|
|
||||||
|
#define alloca_array(type, size) ((type *) alloca ((size) * sizeof (type)))
|
||||||
|
|
||||||
|
#define xfree free
|
||||||
|
/* Free P if it is non-NULL. C requires free() to behaves this way by
|
||||||
|
default, but Wget's code is historically careful not to pass NULL
|
||||||
|
to free. This allows us to assert p!=NULL in xfree to check
|
||||||
|
additional errors. (But we currently don't do that!) */
|
||||||
|
#define xfree_null(p) if (!(p)) ; else xfree (p)
|
||||||
|
|
||||||
|
#endif /* USE_GNULIB_ALLOC */
|
||||||
|
|
||||||
struct hash_table;
|
struct hash_table;
|
||||||
|
|
||||||
struct file_memory {
|
struct file_memory {
|
||||||
|
Loading…
Reference in New Issue
Block a user