1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-26 18:48:55 +02:00

uniq: change macro to function

* src/uniq.c (swap_lines): New static function, replacing
the old SWAP_LINES macro.  These days this is just as fast.
All uses changed.
This commit is contained in:
Paul Eggert
2023-11-15 15:08:34 -08:00
parent 3bee7c9754
commit 77201c506f
+9 -11
View File
@@ -40,15 +40,13 @@
proper_name ("Richard M. Stallman"), \
proper_name ("David MacKenzie")
#define SWAP_LINES(A, B) \
do \
{ \
struct linebuffer *_tmp; \
_tmp = (A); \
(A) = (B); \
(B) = _tmp; \
} \
while (0)
static void
swap_lines (struct linebuffer **a, struct linebuffer **b)
{
struct linebuffer *tmp = *a;
*a = *b;
*b = tmp;
}
/* Number of fields to skip on each line when doing comparisons. */
static idx_t skip_fields = false;
@@ -370,7 +368,7 @@ check_file (char const *infile, char const *outfile, char delimiter)
stdout) != thisline->length)
write_error ();
SWAP_LINES (prevline, thisline);
swap_lines (&prevline, &thisline);
prevfield = thisfield;
prevlen = thislen;
first_group_printed = true;
@@ -433,7 +431,7 @@ check_file (char const *infile, char const *outfile, char delimiter)
if (!match || output_later_repeated)
{
writeline (prevline, match, match_count);
SWAP_LINES (prevline, thisline);
swap_lines (&prevline, &thisline);
prevfield = thisfield;
prevlen = thislen;
if (!match)