summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-08-22 08:57:37 +0000
committerJim Meyering <jim@meyering.net>1999-08-22 08:57:37 +0000
commite23b3347137cd851d3e7a4e4a0f34467589fdbab (patch)
tree66ff2d98abddc7c6c79613a33fcb7efb3c9170f3 /src
parent475a58337a4ab6511fdd78a07ba14a06e883e175 (diff)
downloadcoreutils-e23b3347137cd851d3e7a4e4a0f34467589fdbab.tar.xz
(SWAP_LINES): New macro.
(check_file): Use it here. [really remove min macro, this time]
Diffstat (limited to 'src')
-rw-r--r--src/uniq.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/uniq.c b/src/uniq.c
index 7af6072f1..b17df336d 100644
--- a/src/uniq.c
+++ b/src/uniq.c
@@ -34,9 +34,15 @@
#define AUTHORS "Richard Stallman and David MacKenzie"
-/* Undefine, to avoid warning about redefinition on some systems. */
-#undef min
-#define min(x, y) ((x) < (y) ? (x) : (y))
+#define SWAP_LINES(A, B) \
+ do \
+ { \
+ struct linebuffer *_tmp; \
+ _tmp = (A); \
+ (A) = (B); \
+ (B) = _tmp; \
+ } \
+ while (0)
/* The name this program was run with. */
char *program_name;
@@ -256,11 +262,8 @@ check_file (const char *infile, const char *outfile)
if (!match || mode == output_all_repeated)
{
- struct linebuffer *tmp;
writeline (prevline, ostream, match_count);
- tmp = prevline;
- prevline = thisline;
- thisline = tmp;
+ SWAP_LINES (prevline, thisline);
prevfield = thisfield;
prevlen = thislen;
if (!match)