diff options
author | JinWang An <jinwang.an@samsung.com> | 2022-12-27 12:15:01 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2022-12-27 12:15:01 +0900 |
commit | 02a08acfc3145de1707c7704c566e4401ff5a8de (patch) | |
tree | 1c41a0a5565eb993984a585a0dd8ef13735ceede /src/util.c | |
parent | 90dfac14e6a0169336b5b7210e4a160df8b91c68 (diff) | |
download | diffutils-upstream/3.6.tar.gz diffutils-upstream/3.6.tar.bz2 diffutils-upstream/3.6.zip |
Imported Upstream version 3.6upstream/3.6
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 37 |
1 files changed, 18 insertions, 19 deletions
@@ -1,7 +1,7 @@ /* Support routines for GNU DIFF. Copyright (C) 1988-1989, 1992-1995, 1998, 2001-2002, 2004, 2006, 2009-2013, - 2015-2016 Free Software Foundation, Inc. + 2015-2017 Free Software Foundation, Inc. This file is part of GNU DIFF. @@ -20,6 +20,7 @@ #include "diff.h" #include "argmatch.h" +#include "die.h" #include <dirname.h> #include <error.h> #include <system-quote.h> @@ -77,8 +78,7 @@ pfatal_with_name (char const *name) { int e = errno; print_message_queue (); - error (EXIT_TROUBLE, e, "%s", name); - abort (); + die (EXIT_TROUBLE, e, "%s", name); } /* Print an error message containing MSGID, then exit. */ @@ -87,8 +87,7 @@ void fatal (char const *msgid) { print_message_queue (); - error (EXIT_TROUBLE, 0, "%s", _(msgid)); - abort (); + die (EXIT_TROUBLE, 0, "%s", _(msgid)); } /* Like printf, except if -l in effect then save the message and print later. @@ -383,7 +382,7 @@ get_funky_string (char **dest, const char **src, bool equals_end, state = ST_END; /* End */ break; } - /* else fall through */ + FALLTHROUGH; default: *(q++) = *(p++); ++count; @@ -965,7 +964,7 @@ finish_output (void) ? WEXITSTATUS (wstatus) : INT_MAX); if (status) - error (EXIT_TROUBLE, werrno, + die (EXIT_TROUBLE, werrno, _(status == 126 ? "subsidiary program '%s' could not be invoked" : status == 127 @@ -1090,7 +1089,7 @@ lines_differ (char const *s1, char const *s2) } if (ignore_white_space == IGNORE_TRAILING_SPACE) break; - /* Fall through. */ + FALLTHROUGH; case IGNORE_TAB_EXPANSION: if ((c1 == ' ' && c2 == '\t') || (c1 == '\t' && c2 == ' ')) @@ -1401,13 +1400,13 @@ translate_line_number (struct file_data const *file, lin i) } /* Translate a line number range. This is always done for printing, - so for convenience translate to long int rather than lin, so that the - caller can use printf with "%ld" without casting. */ + so for convenience translate to printint rather than lin, so that the + caller can use printf with "%"pI"d" without casting. */ void translate_range (struct file_data const *file, lin a, lin b, - long int *aptr, long int *bptr) + printint *aptr, printint *bptr) { *aptr = translate_line_number (file, a - 1) + 1; *bptr = translate_line_number (file, b + 1) - 1; @@ -1422,16 +1421,16 @@ translate_range (struct file_data const *file, void print_number_range (char sepchar, struct file_data *file, lin a, lin b) { - long int trans_a, trans_b; + printint trans_a, trans_b; translate_range (file, a, b, &trans_a, &trans_b); /* Note: we can have B < A in the case of a range of no lines. In this case, we should print the line number before the range, which is B. */ if (trans_b > trans_a) - fprintf (outfile, "%ld%c%ld", trans_a, sepchar, trans_b); + fprintf (outfile, "%"pI"d%c%"pI"d", trans_a, sepchar, trans_b); else - fprintf (outfile, "%ld", trans_b); + fprintf (outfile, "%"pI"d", trans_b); } /* Look at a hunk of edit script and report the range of lines in each file @@ -1565,11 +1564,11 @@ debug_script (struct change *sp) for (; sp; sp = sp->link) { - long int line0 = sp->line0; - long int line1 = sp->line1; - long int deleted = sp->deleted; - long int inserted = sp->inserted; - fprintf (stderr, "%3ld %3ld delete %ld insert %ld\n", + printint line0 = sp->line0; + printint line1 = sp->line1; + printint deleted = sp->deleted; + printint inserted = sp->inserted; + fprintf (stderr, "%3"pI"d %3"pI"d delete %"pI"d insert %"pI"d\n", line0, line1, deleted, inserted); } |