diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmp.c | 2 | ||||
-rw-r--r-- | src/context.c | 18 | ||||
-rw-r--r-- | src/diff.c | 40 | ||||
-rw-r--r-- | src/diff3.c | 4 | ||||
-rw-r--r-- | src/dir.c | 6 | ||||
-rw-r--r-- | src/ifdef.c | 8 | ||||
-rw-r--r-- | src/sdiff.c | 2 | ||||
-rw-r--r-- | src/util.c | 21 |
8 files changed, 51 insertions, 50 deletions
@@ -251,7 +251,7 @@ main (int argc, char **argv) case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; diff --git a/src/context.c b/src/context.c index 2ed7478..a4c76ca 100644 --- a/src/context.c +++ b/src/context.c @@ -196,7 +196,7 @@ pr_context_hunk (struct change *hunk) last1 = files[1].valid_lines - 1; /* If desired, find the preceding function definition line in file 0. */ - function = NULL; + function = nullptr; if (function_regexp.fastmap) function = find_function (files[0].linbuf, first0); @@ -345,7 +345,7 @@ pr_unidiff_hunk (struct change *hunk) last1 = files[1].valid_lines - 1; /* If desired, find the preceding function definition line in file 0. */ - function = NULL; + function = nullptr; if (function_regexp.fastmap) function = find_function (files[0].linbuf, first0); @@ -379,7 +379,7 @@ pr_unidiff_hunk (struct change *hunk) char const *const *line = &files[0].linbuf[i++]; if (! (suppress_blank_empty && **line == '\n')) putc (initial_tab ? '\t' : ' ', out); - print_1_line (NULL, line); + print_1_line (nullptr, line); j++; } else @@ -395,7 +395,7 @@ pr_unidiff_hunk (struct change *hunk) putc ('-', out); if (initial_tab && ! (suppress_blank_empty && **line == '\n')) putc ('\t', out); - print_1_line_nl (NULL, line, true); + print_1_line_nl (nullptr, line, true); set_color_context (RESET_CONTEXT); @@ -414,7 +414,7 @@ pr_unidiff_hunk (struct change *hunk) putc ('+', out); if (initial_tab && ! (suppress_blank_empty && **line == '\n')) putc ('\t', out); - print_1_line_nl (NULL, line, true); + print_1_line_nl (nullptr, line, true); set_color_context (RESET_CONTEXT); @@ -481,7 +481,7 @@ mark_ignorable (struct change *script) lin first0, last0, first1, last1; /* Turn this change into a hunk: detach it from the others. */ - script->link = NULL; + script->link = nullptr; /* Determine whether this change is ignorable. */ script->ignore = ! analyze_hunk (script, @@ -497,7 +497,7 @@ mark_ignorable (struct change *script) /* Find the last function-header line in LINBUF prior to line number LINENUM. This is a line containing a match for the regexp in 'function_regexp'. - Return the address of the text, or NULL if no function-header is found. */ + 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) @@ -516,7 +516,7 @@ find_function (char const * const *linbuf, lin linenum) to LEN = LINELEN and no machine code is generated. */ regoff_t len = MIN (linelen, TYPE_MAXIMUM (regoff_t)); - if (0 <= re_search (&function_regexp, line, len, 0, len, NULL)) + if (0 <= re_search (&function_regexp, line, len, 0, len, nullptr)) { find_function_last_match = i; return line; @@ -527,5 +527,5 @@ find_function (char const * const *linbuf, lin linenum) if (find_function_last_match != LIN_MAX) return linbuf[find_function_last_match]; - return NULL; + return nullptr; } @@ -224,7 +224,7 @@ static struct option const longopts[] = {"width", 1, 0, 'W'}, /* This is solely for testing. Do not document. */ - {"-presume-output-tty", no_argument, NULL, PRESUME_OUTPUT_TTY_OPTION}, + {"-presume-output-tty", no_argument, nullptr, PRESUME_OUTPUT_TTY_OPTION}, {0, 0, 0, 0} }; @@ -283,8 +283,8 @@ main (int argc, char **argv) bool explicit_context = false; size_t width = 0; bool show_c_function = false; - char const *from_file = NULL; - char const *to_file = NULL; + char const *from_file = nullptr; + char const *to_file = nullptr; intmax_t numval; char *numend; @@ -305,7 +305,7 @@ main (int argc, char **argv) /* Decode the options. */ - while ((c = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) + while ((c = getopt_long (argc, argv, shortopts, longopts, nullptr)) != -1) { switch (c) { @@ -477,7 +477,7 @@ main (int argc, char **argv) case 'l': if (!pr_program[0]) - try_help ("pagination not supported on this host", NULL); + try_help ("pagination not supported on this host", nullptr); paginate = true; #ifdef SIGCHLD /* Pagination requires forking and waiting, and @@ -544,7 +544,7 @@ main (int argc, char **argv) case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; @@ -697,7 +697,7 @@ main (int argc, char **argv) break; default: - try_help (NULL, NULL); + try_help (nullptr, nullptr); } prev = c; } @@ -824,7 +824,7 @@ main (int argc, char **argv) else for (; optind < argc; optind++) { - int status = compare_files (NULL, from_file, argv[optind]); + int status = compare_files (nullptr, from_file, argv[optind]); if (exit_status < status) exit_status = status; } @@ -834,7 +834,7 @@ main (int argc, char **argv) if (to_file) for (; optind < argc; optind++) { - int status = compare_files (NULL, argv[optind], to_file); + int status = compare_files (nullptr, argv[optind], to_file); if (exit_status < status) exit_status = status; } @@ -848,7 +848,7 @@ main (int argc, char **argv) try_help ("extra operand '%s'", argv[optind + 2]); } - exit_status = compare_files (NULL, argv[optind], argv[optind + 1]); + exit_status = compare_files (nullptr, argv[optind], argv[optind + 1]); } } @@ -1081,7 +1081,7 @@ specify_value (char const **var, char const *value, char const *option) if (*var && ! STREQ (*var, value)) { error (0, 0, _("conflicting %s option value '%s'"), option, value); - try_help (NULL, NULL); + try_help (nullptr, nullptr); } *var = value; } @@ -1093,7 +1093,7 @@ specify_style (enum output_style style) if (output_style != style) { if (output_style != OUTPUT_UNSPECIFIED) - try_help ("conflicting output style options", NULL); + try_help ("conflicting output style options", nullptr); output_style = style; } } @@ -1102,7 +1102,7 @@ specify_style (enum output_style style) static void specify_colors_style (char const *value) { - if (value == NULL || STREQ (value, "auto")) + if (value == nullptr || STREQ (value, "auto")) colors_style = AUTO; else if (STREQ (value, "always")) colors_style = ALWAYS; @@ -1194,17 +1194,17 @@ compare_files (struct comparison const *parent, if (!parent) { - free0 = NULL; - free1 = NULL; + free0 = nullptr; + free1 = nullptr; cmp.file[0].name = name0; cmp.file[1].name = name1; } else { cmp.file[0].name = free0 - = file_name_concat (parent->file[0].name, name0, NULL); + = file_name_concat (parent->file[0].name, name0, nullptr); cmp.file[1].name = free1 - = file_name_concat (parent->file[1].name, name1, NULL); + = file_name_concat (parent->file[1].name, name1, nullptr); } /* Stat the files. */ @@ -1370,7 +1370,7 @@ compare_files (struct comparison const *parent, { char const *dir; - /* PARENT must be non-NULL here. */ + /* PARENT must be non-null here. */ assert (parent); dir = parent->file[cmp.file[0].desc == NONEXISTENT].name; @@ -1405,12 +1405,12 @@ compare_files (struct comparison const *parent, && S_ISLNK (cmp.file[1].stat.st_mode)) { /* Compare the values of the symbolic links. */ - char *link_value[2] = { NULL, NULL }; + char *link_value[2] = { nullptr, nullptr }; for (f = 0; f < 2; f++) { link_value[f] = xreadlink (cmp.file[f].name); - if (link_value[f] == NULL) + if (link_value[f] == nullptr) { perror_with_name (cmp.file[f].name); status = EXIT_TROUBLE; diff --git a/src/diff3.c b/src/diff3.c index c4bd7b8..aef0044 100644 --- a/src/diff3.c +++ b/src/diff3.c @@ -329,7 +329,7 @@ main (int argc, char **argv) break; case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; case DIFF_PROGRAM_OPTION: @@ -1091,7 +1091,7 @@ process_diff (char const *filea, block_list_end = &bptr->next; } - *block_list_end = NULL; + *block_list_end = nullptr; return block_list; } @@ -342,8 +342,8 @@ find_dir_file_pathname (char const *dir, char const *file) char *val; struct dirdata dirdata; - dirdata.names = NULL; - dirdata.data = NULL; + dirdata.names = nullptr; + dirdata.data = nullptr; if (ignore_file_name_case) { @@ -373,7 +373,7 @@ find_dir_file_pathname (char const *dir, char const *file) } } - val = file_name_concat (dir, match, NULL); + val = file_name_concat (dir, match, nullptr); free (dirdata.names); free (dirdata.data); return val; diff --git a/src/ifdef.c b/src/ifdef.c index 0939c1a..d83a387 100644 --- a/src/ifdef.c +++ b/src/ifdef.c @@ -395,7 +395,7 @@ scan_char_literal (char const *lit, char *valptr) { case 0: case '\'': - return NULL; + return nullptr; case '\\': value = 0; @@ -403,18 +403,18 @@ scan_char_literal (char const *lit, char *valptr) { unsigned int digit = c - '0'; if (8 <= digit) - return NULL; + return nullptr; value = 8 * value + digit; } digits = p - lit - 2; if (! (1 <= digits && digits <= 3)) - return NULL; + return nullptr; break; default: value = c; if (*p++ != '\'') - return NULL; + return nullptr; break; } diff --git a/src/sdiff.c b/src/sdiff.c index ded1837..1633565 100644 --- a/src/sdiff.c +++ b/src/sdiff.c @@ -518,7 +518,7 @@ main (int argc, char *argv[]) case 'v': version_etc (stdout, PROGRAM_NAME, PACKAGE_NAME, Version, - AUTHORS, (char *) NULL); + AUTHORS, nullptr); check_stdout (); return EXIT_SUCCESS; @@ -287,7 +287,7 @@ process_signals (void) /* Exit or suspend the program. */ if (raise (sig) != 0) pfatal_with_name ("raise"); - xsigprocmask (SIG_SETMASK, &oldset, NULL); + xsigprocmask (SIG_SETMASK, &oldset, nullptr); /* If execution reaches here, then the program has been continued (after being suspended). */ @@ -351,7 +351,7 @@ install_signal_handlers (void) for (int j = 0; j < nsigs; j++) { struct sigaction actj; - if (sigaction (sig[j], NULL, &actj) == 0 && actj.sa_handler != SIG_IGN) + if (sigaction (sig[j], nullptr, &actj) == 0 && actj.sa_handler != SIG_IGN) xsigaddset (&caught_signals, sig[j]); } @@ -363,7 +363,7 @@ install_signal_handlers (void) if (xsigismember (&caught_signals, sig[j])) { act.sa_handler = is_tstp_index (j) ? stophandler : sighandler; - if (sigaction (sig[j], &act, NULL) != 0) + if (sigaction (sig[j], &act, nullptr) != 0) pfatal_with_name ("sigaction"); some_signals_caught = true; } @@ -403,7 +403,7 @@ static char const *current_name1; static bool currently_recursive; static bool colors_enabled; -static struct color_ext_type *color_ext_list = NULL; +static struct color_ext_type *color_ext_list = nullptr; struct bin_str { @@ -642,7 +642,7 @@ static struct bin_str color_indicator[] = { { LEN_STR_PAIR ("\033[") }, /* lc: Left of color sequence */ { LEN_STR_PAIR ("m") }, /* rc: Right of color sequence */ - { 0, NULL }, /* ec: End color (replaces lc+rs+rc) */ + { 0, nullptr }, /* ec: End color (replaces lc+rs+rc) */ { LEN_STR_PAIR ("0") }, /* rs: Reset to ordinary colors */ { LEN_STR_PAIR ("1") }, /* hd: Header */ { LEN_STR_PAIR ("32") }, /* ad: Add line */ @@ -652,7 +652,7 @@ static struct bin_str color_indicator[] = static const char *const indicator_name[] = { - "lc", "rc", "ec", "rs", "hd", "ad", "de", "ln", NULL + "lc", "rc", "ec", "rs", "hd", "ad", "de", "ln", nullptr }; ARGMATCH_VERIFY (indicator_name, color_indicator); @@ -674,10 +674,11 @@ parse_diff_color (void) char label[] = "??"; /* Indicator label */ struct color_ext_type *ext; /* Extension we are working on */ - if ((p = color_palette) == NULL || *p == '\0') + p = color_palette; + if (p == nullptr || *p == '\0') return; - ext = NULL; + ext = nullptr; /* This is an overly conservative estimate, but any possible --palette string will *not* generate a color_buf longer than @@ -739,7 +740,7 @@ parse_diff_color (void) state = PS_FAIL; /* Assume failure... */ if (*(p++) == '=')/* It *should* be... */ { - for (ind_no = 0; indicator_name[ind_no] != NULL; ++ind_no) + for (ind_no = 0; indicator_name[ind_no] != nullptr; ++ind_no) { if (STREQ (label, indicator_name[ind_no])) { @@ -783,7 +784,7 @@ parse_diff_color (void) error (0, 0, _("unparsable value for --palette")); free (color_buf); - for (e = color_ext_list; e != NULL; /* empty */) + for (e = color_ext_list; e != nullptr; /* empty */) { e2 = e; e = e->next; |