--- embedaddon/libiconv/tests/uniq-u.c 2012/02/21 22:57:49 1.1 +++ embedaddon/libiconv/tests/uniq-u.c 2021/03/17 13:38:46 1.1.1.3 @@ -1,5 +1,5 @@ /* uniq -- remove duplicate lines from a sorted file - Copyright (C) 86, 91, 1995-1998, 1999 Free Software Foundation, Inc. + Copyright (C) 86, 91, 1995-1998, 1999, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -12,7 +12,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + along with this program. If not, see . */ /* Written by Richard Stallman and David MacKenzie. */ /* 2000-03-22 Trimmed down to the case of "uniq -u" by Bruno Haible. */ @@ -58,12 +58,12 @@ xrealloc (void *p, size_t n) return p; } -/* A `struct linebuffer' holds a line of text. */ +/* A 'struct linebuffer' holds a line of text. */ struct linebuffer { - size_t size; /* Allocated. */ - size_t length; /* Used. */ + size_t size; /* Allocated. */ + size_t length; /* Used. */ char *buffer; }; @@ -97,21 +97,21 @@ readline (struct linebuffer *linebuffer, FILE *stream) { c = getc (stream); if (c == EOF) - { - if (p == buffer) - return 0; - if (p[-1] == '\n') - break; - c = '\n'; - } + { + if (p == buffer) + return 0; + if (p[-1] == '\n') + break; + c = '\n'; + } if (p == end) - { - linebuffer->size *= 2; - buffer = (char *) xrealloc (buffer, linebuffer->size); - p = p - linebuffer->buffer + buffer; - linebuffer->buffer = buffer; - end = buffer + linebuffer->size - 1; - } + { + linebuffer->size *= 2; + buffer = (char *) xrealloc (buffer, linebuffer->size); + p = p - linebuffer->buffer + buffer; + linebuffer->buffer = buffer; + end = buffer + linebuffer->size - 1; + } *p++ = c; } while (c != '\n'); @@ -210,25 +210,25 @@ check_file (const char *infile, const char *outfile) { int match; if (readline (thisline, istream) == 0) - break; + break; thisfield = thisline->buffer; thislen = thisline->length; match = !different (thisfield, prevfield, thislen, prevlen); if (match) - ++match_count; + ++match_count; if (!match) - { - writeline (prevline, ostream, match_count); - exch = prevline; - prevline = thisline; - thisline = exch; - prevfield = thisfield; - prevlen = thislen; - if (!match) - match_count = 0; - } + { + writeline (prevline, ostream, match_count); + exch = prevline; + prevline = thisline; + thisline = exch; + prevfield = thisfield; + prevlen = thislen; + if (!match) + match_count = 0; + } } writeline (prevline, ostream, match_count);