diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-10-02 21:52:29 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-10-02 21:52:29 +0000 |
commit | f600bdbfd5ad7b3d67f82e448050c91621ca955c (patch) | |
tree | fcad082951e661144891b2cc5565265f812f5a18 | |
parent | add O_CLOEXEC fallback define #363271 (diff) | |
download | portage-utils-f600bdbfd5ad7b3d67f82e448050c91621ca955c.tar.gz portage-utils-f600bdbfd5ad7b3d67f82e448050c91621ca955c.tar.bz2 portage-utils-f600bdbfd5ad7b3d67f82e448050c91621ca955c.zip |
make MIN/MAX helpers generally available
-rw-r--r-- | main.h | 9 | ||||
-rw-r--r-- | qtbz2.c | 7 |
2 files changed, 11 insertions, 5 deletions
@@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.h,v 1.8 2011/03/30 05:33:19 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.h,v 1.9 2011/10/02 21:52:29 vapier Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -68,4 +68,11 @@ #define GETOPT_LONG(A, a, ex) \ getopt_long(argc, argv, ex A ## _FLAGS, a ## _long_opts, NULL) +#ifndef MIN +#define MIN(x, y) ((x) < (y) ? (x) : (y)) +#endif +#ifndef MAX +#define MAX(x, y) ((x) < (y) ? (y) : (x)) +#endif + #define a_argument required_argument @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qtbz2.c,v 1.18 2011/02/28 18:21:42 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qtbz2.c,v 1.19 2011/10/02 21:52:29 vapier Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -46,7 +46,7 @@ static const char * const qtbz2_opts_help[] = { "Write files to stdout", COMMON_OPTS_HELP }; -static const char qtbz2_rcsid[] = "$Id: qtbz2.c,v 1.18 2011/02/28 18:21:42 vapier Exp $"; +static const char qtbz2_rcsid[] = "$Id: qtbz2.c,v 1.19 2011/10/02 21:52:29 vapier Exp $"; #define qtbz2_usage(ret) usage(ret, QTBZ2_FLAGS, qtbz2_long_opts, qtbz2_opts_help, lookup_applet_idx("qtbz2")) static char tbz2_stdout = 0; @@ -148,7 +148,6 @@ tbz2_compose(int dir_fd, const char *tarbz2, const char *xpak, const char *tbz2) return ret; } -#define _TBZ2_MIN(a,b) (a < b ? : b) static void _tbz2_write_file(FILE *src, int dir_fd, const char *dst, size_t len) { @@ -174,7 +173,7 @@ _tbz2_write_file(FILE *src, int dir_fd, const char *dst, size_t len) out = stdout; do { - this_write = fread(buffer, 1, _TBZ2_MIN(len, sizeof(buffer)), src); + this_write = fread(buffer, 1, MIN(len, sizeof(buffer)), src); fwrite(buffer, 1, this_write, out); len -= this_write; } while (len && this_write); |