mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Define MIN and MAx macros in a single location
MIN and MAx are macros that a developer will universally expect throughout the source. Yet, they were being defined in multiple places across the source. Instead, define them in a single location in the common wget.h header file and use them consistently everywhere.
This commit is contained in:
parent
aeca2c33c0
commit
4b845615fa
@ -1,3 +1,9 @@
|
||||
2014-12-04 Darshit Shah <darnir@gmail.com>
|
||||
|
||||
* wget.h: Define MIX and MAX macros globally for all files
|
||||
* gnutls.c, retr.c: Delete declaration of MIN macro
|
||||
* http.c, progress.c: Delete declaration of MIN and MAX macros
|
||||
|
||||
2014-12-03 Gisle Vanem <gvanem@yahoo.no>
|
||||
|
||||
* openssl.c (ssl_init): Fix C89 warning
|
||||
|
@ -229,11 +229,6 @@ struct wgnutls_transport_context
|
||||
int peeklen;
|
||||
};
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(i, j) ((i) <= (j) ? (i) : (j))
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
wgnutls_read_timeout (int fd, char *buf, int bufsize, void *arg, double timeout)
|
||||
{
|
||||
|
@ -81,11 +81,6 @@ static bool known_authentication_scheme_p (const char *, const char *);
|
||||
static void ensure_extension (struct http_stat *, const char *, int *);
|
||||
static void load_cookies (void);
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(x, y) ((x) > (y) ? (y) : (x))
|
||||
#endif
|
||||
|
||||
|
||||
static bool cookies_loaded_p;
|
||||
static struct cookie_jar *wget_cookie_jar;
|
||||
|
||||
@ -1161,9 +1156,6 @@ append_value_to_filename (char **filename, param_token const * const value,
|
||||
url_unescape (*filename + original_length);
|
||||
}
|
||||
|
||||
#undef MAX
|
||||
#define MAX(p, q) ((p) > (q) ? (p) : (q))
|
||||
|
||||
/* Parse the contents of the `Content-Disposition' header, extracting
|
||||
the information useful to Wget. Content-Disposition is a header
|
||||
borrowed from MIME; when used in HTTP, it typically serves for
|
||||
|
@ -896,13 +896,6 @@ get_eta (int *bcd)
|
||||
are confused when they see strchr (s, '\0') in the code. */
|
||||
#define move_to_end(s) s = strchr (s, '\0');
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(a, b) ((a) >= (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MIN
|
||||
# define MIN(a, b) ((a) <= (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static void
|
||||
create_image (struct bar_progress *bp, double dl_total_time, bool done)
|
||||
{
|
||||
|
@ -136,10 +136,6 @@ limit_bandwidth (wgint bytes, struct ptimer *timer)
|
||||
limit_data.chunk_start = ptimer_read (timer);
|
||||
}
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(i, j) ((i) <= (j) ? (i) : (j))
|
||||
#endif
|
||||
|
||||
/* Write data in BUF to OUT. However, if *SKIP is non-zero, skip that
|
||||
amount of data and decrease SKIP. Increment *TOTAL by the amount
|
||||
of data written. If OUT2 is not NULL, also write BUF to OUT2.
|
||||
|
@ -317,6 +317,11 @@ typedef double SUM_SIZE_INT;
|
||||
in base 10. 24082 / 10000 = 8*log_{10}(2). */
|
||||
#define MAX_INT_TO_STRING_LEN(x) ((sizeof(x) * 24082 / 10000) + 2)
|
||||
|
||||
/* Find the minimum or maximum of two provided values */
|
||||
# define MIN(i, j) ((i) <= (j) ? (i) : (j))
|
||||
# define MAX(i, j) ((i) >= (j) ? (i) : (j))
|
||||
|
||||
|
||||
extern const char *exec_name;
|
||||
extern const char *program_name;
|
||||
extern const char *program_argstring;
|
||||
|
Loading…
Reference in New Issue
Block a user