mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-27 01:44:20 +00:00
maint: prefer ‘*const’ to ‘* const’
Prefer declarations like ‘char *const *x;’ to ‘char * const *x;’, for consistency between ‘*const’ and ‘*x’, and to highlight the fact that the ‘const’ belongs to the preceding ‘*’ not to the following ‘*’. Similarly for ‘* volatile’.
This commit is contained in:
parent
61c1fffe7b
commit
71430dd736
@ -163,7 +163,7 @@ check_stdout (void)
|
||||
die (EXIT_TROUBLE, errno, "%s", _("standard output"));
|
||||
}
|
||||
|
||||
static char const * const option_help_msgid[] = {
|
||||
static char const *const option_help_msgid[] = {
|
||||
N_("-b, --print-bytes print differing bytes"),
|
||||
N_("-i, --ignore-initial=SKIP skip first SKIP bytes of both inputs"),
|
||||
N_("-i, --ignore-initial=SKIP1:SKIP2 skip first SKIP1 bytes of FILE1 and\n"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include <stat-time.h>
|
||||
#include <strftime.h>
|
||||
|
||||
static char const *find_function (char const * const *, lin);
|
||||
static char const *find_function (char const *const *, lin);
|
||||
static struct change *find_hunk (struct change *);
|
||||
static void mark_ignorable (struct change *);
|
||||
static void pr_context_hunk (struct change *);
|
||||
@ -376,7 +376,7 @@ pr_unidiff_hunk (struct change *hunk)
|
||||
|
||||
while (k--)
|
||||
{
|
||||
char const * const *line = &files[0].linbuf[i++];
|
||||
char const *const *line = &files[0].linbuf[i++];
|
||||
set_color_context (DELETE_CONTEXT);
|
||||
putc ('-', out);
|
||||
if (initial_tab && ! (suppress_blank_empty && **line == '\n'))
|
||||
@ -395,7 +395,7 @@ pr_unidiff_hunk (struct change *hunk)
|
||||
|
||||
while (k--)
|
||||
{
|
||||
char const * const *line = &files[1].linbuf[j++];
|
||||
char const *const *line = &files[1].linbuf[j++];
|
||||
set_color_context (ADD_CONTEXT);
|
||||
putc ('+', out);
|
||||
if (initial_tab && ! (suppress_blank_empty && **line == '\n'))
|
||||
@ -482,7 +482,7 @@ mark_ignorable (struct change *script)
|
||||
Return the address of the text, or null if no function-header is found. */
|
||||
|
||||
static char const *
|
||||
find_function (char const * const *linbuf, lin linenum)
|
||||
find_function (char const *const *linbuf, lin linenum)
|
||||
{
|
||||
lin i = linenum;
|
||||
lin last = find_function_last_search;
|
||||
|
||||
@ -945,7 +945,7 @@ check_stdout (void)
|
||||
pfatal_with_name (_("standard output"));
|
||||
}
|
||||
|
||||
static char const * const option_help_msgid[] = {
|
||||
static char const *const option_help_msgid[] = {
|
||||
N_(" --normal output a normal diff (the default)"),
|
||||
N_("-q, --brief report only when files differ"),
|
||||
N_("-s, --report-identical-files report when two files are the same"),
|
||||
|
||||
@ -358,7 +358,8 @@ XTERN FILE *outfile;
|
||||
extern int diff_2_files (struct comparison *);
|
||||
|
||||
/* context.c */
|
||||
extern void print_context_header (struct file_data[], char const * const *, bool);
|
||||
extern void print_context_header (struct file_data[],
|
||||
char const *const *, bool);
|
||||
extern void print_context_script (struct change *, bool);
|
||||
|
||||
/* dir.c */
|
||||
@ -407,8 +408,8 @@ extern void output_1_line (char const *, char const *, char const *,
|
||||
char const *);
|
||||
extern void perror_with_name (char const *);
|
||||
extern _Noreturn void pfatal_with_name (char const *);
|
||||
extern void print_1_line (char const *, char const * const *);
|
||||
extern void print_1_line_nl (char const *, char const * const *, bool);
|
||||
extern void print_1_line (char const *, char const *const *);
|
||||
extern void print_1_line_nl (char const *, char const *const *, bool);
|
||||
extern void print_message_queue (void);
|
||||
extern void print_number_range (char, struct file_data *, lin, lin);
|
||||
extern void print_script (struct change *, struct change * (*) (struct change *),
|
||||
|
||||
19
src/diff3.c
19
src/diff3.c
@ -182,8 +182,9 @@ static bool merge;
|
||||
static char *read_diff (char const *, char const *, char **);
|
||||
static char *scan_diff_line (char *, char **, idx_t *, char *, char);
|
||||
static enum diff_type process_diff_control (char **, struct diff_block *);
|
||||
static bool compare_line_list (char * const[], idx_t const[], char * const[], idx_t const[], lin);
|
||||
static bool copy_stringlist (char * const[], idx_t const[], char *[], idx_t[], lin);
|
||||
static bool compare_line_list (char *const[], idx_t const[],
|
||||
char *const[], idx_t const[], lin);
|
||||
static bool copy_stringlist (char *const[], idx_t const[], char *[], idx_t[], lin);
|
||||
static bool output_diff3_edscript (FILE *, struct diff3_block *, int const[3], int const[3], char const *, char const *, char const *);
|
||||
static bool output_diff3_merge (FILE *, FILE *, struct diff3_block *, int const[3], int const[3], char const *, char const *, char const *);
|
||||
static struct diff3_block *create_diff3_block (lin, lin, lin, lin, lin, lin);
|
||||
@ -468,7 +469,7 @@ check_stdout (void)
|
||||
perror_with_exit (_("standard output"));
|
||||
}
|
||||
|
||||
static char const * const option_help_msgid[] = {
|
||||
static char const *const option_help_msgid[] = {
|
||||
N_("-A, --show-all output all changes, bracketing conflicts"),
|
||||
"",
|
||||
N_("-e, --ed output ed script incorporating changes\n"
|
||||
@ -835,11 +836,11 @@ using_to_diff3_block (struct diff_block *using[2],
|
||||
incomplete. Upon successful completion of the copy, return true. */
|
||||
|
||||
static bool
|
||||
copy_stringlist (char * const fromptrs[], idx_t const fromlengths[],
|
||||
copy_stringlist (char *const fromptrs[], idx_t const fromlengths[],
|
||||
char *toptrs[], idx_t tolengths[],
|
||||
lin copynum)
|
||||
{
|
||||
register char * const *f = fromptrs;
|
||||
register char *const *f = fromptrs;
|
||||
register char **t = toptrs;
|
||||
idx_t const *fl = fromlengths;
|
||||
idx_t *tl = tolengths;
|
||||
@ -930,12 +931,12 @@ create_diff3_block (lin low0, lin high0,
|
||||
Return 1 if they are equivalent, 0 if not. */
|
||||
|
||||
static bool
|
||||
compare_line_list (char * const list1[], idx_t const lengths1[],
|
||||
char * const list2[], idx_t const lengths2[],
|
||||
compare_line_list (char *const list1[], idx_t const lengths1[],
|
||||
char *const list2[], idx_t const lengths2[],
|
||||
lin nl)
|
||||
{
|
||||
char * const *l1 = list1;
|
||||
char * const *l2 = list2;
|
||||
char *const *l1 = list1;
|
||||
char *const *l2 = list2;
|
||||
idx_t const *lgths1 = lengths1;
|
||||
idx_t const *lgths2 = lengths2;
|
||||
|
||||
|
||||
@ -323,7 +323,7 @@ char *
|
||||
find_dir_file_pathname (char const *dir, char const *file)
|
||||
{
|
||||
/* IF_LINT due to GCC bug 21161. */
|
||||
char const * IF_LINT (volatile) match = file;
|
||||
char const *IF_LINT (volatile) match = file;
|
||||
|
||||
struct dirdata dirdata;
|
||||
dirdata.names = nullptr;
|
||||
|
||||
@ -232,7 +232,7 @@ print_ifdef_lines (register FILE *out, char const *format,
|
||||
return;
|
||||
|
||||
struct file_data const *file = group->file;
|
||||
char const * const *linbuf = file->linbuf;
|
||||
char const *const *linbuf = file->linbuf;
|
||||
lin from = group->from, upto = group->upto;
|
||||
|
||||
/* If possible, use a single fwrite; it's faster. */
|
||||
|
||||
@ -50,7 +50,7 @@ enum { SDIFF_BUFSIZE = 65536 };
|
||||
static char const *editor_program = DEFAULT_EDITOR_PROGRAM;
|
||||
static char const **diffargv;
|
||||
|
||||
static char * volatile tmpname;
|
||||
static char *volatile tmpname;
|
||||
static FILE *tmp;
|
||||
|
||||
#if HAVE_WORKING_FORK
|
||||
@ -179,7 +179,7 @@ check_stdout (void)
|
||||
perror_fatal (_("standard output"));
|
||||
}
|
||||
|
||||
static char const * const option_help_msgid[] = {
|
||||
static char const *const option_help_msgid[] = {
|
||||
N_("-o, --output=FILE operate interactively, sending output to FILE"),
|
||||
"",
|
||||
N_("-i, --ignore-case consider upper- and lower-case to be the same"),
|
||||
|
||||
@ -1551,8 +1551,8 @@ analyze_hunk (struct change *hunk,
|
||||
bool skip_leading_white_space =
|
||||
skip_white_space && IGNORE_SPACE_CHANGE <= ignore_white_space;
|
||||
|
||||
char const * const *linbuf0 = files[0].linbuf; /* Help the compiler. */
|
||||
char const * const *linbuf1 = files[1].linbuf;
|
||||
char const *const *linbuf0 = files[0].linbuf; /* Help the compiler. */
|
||||
char const *const *linbuf1 = files[1].linbuf;
|
||||
|
||||
lin show_from = 0, show_to = 0;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user