diff options
Diffstat (limited to 'src/tr.c')
| -rw-r--r-- | src/tr.c | 46 |
1 files changed, 23 insertions, 23 deletions
@@ -268,13 +268,13 @@ static char xlate[N_CHARS]; static struct option const long_options[] = { - {"complement", no_argument, NULL, 'c'}, - {"delete", no_argument, NULL, 'd'}, - {"squeeze-repeats", no_argument, NULL, 's'}, - {"truncate-set1", no_argument, NULL, 't'}, + {"complement", no_argument, nullptr, 'c'}, + {"delete", no_argument, nullptr, 'd'}, + {"squeeze-repeats", no_argument, nullptr, 's'}, + {"truncate-set1", no_argument, nullptr, 't'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, - {NULL, 0, NULL, 0} + {nullptr, 0, nullptr, 0} }; void @@ -591,7 +591,7 @@ make_printable_str (char const *s, size_t len) for (size_t i = 0; i < len; i++) { char buf[5]; - char const *tmp = NULL; + char const *tmp = nullptr; unsigned char c = s[i]; switch (c) @@ -643,7 +643,7 @@ static void append_normal_char (struct Spec_list *list, unsigned char c) { struct List_element *new = xmalloc (sizeof *new); - new->next = NULL; + new->next = nullptr; new->type = RE_NORMAL_CHAR; new->u.normal_char = c; assert (list->tail); @@ -672,7 +672,7 @@ append_range (struct Spec_list *list, unsigned char first, unsigned char last) return false; } struct List_element *new = xmalloc (sizeof *new); - new->next = NULL; + new->next = nullptr; new->type = RE_RANGE; new->u.range.first_char = first; new->u.range.last_char = last; @@ -695,7 +695,7 @@ append_char_class (struct Spec_list *list, if (char_class == CC_NO_CLASS) return false; struct List_element *new = xmalloc (sizeof *new); - new->next = NULL; + new->next = nullptr; new->type = RE_CHAR_CLASS; new->u.char_class = char_class; assert (list->tail); @@ -714,7 +714,7 @@ append_repeated_char (struct Spec_list *list, unsigned char the_char, count repeat_count) { struct List_element *new = xmalloc (sizeof *new); - new->next = NULL; + new->next = nullptr; new->type = RE_REPEATED_CHAR; new->u.repeated_char.the_repeated_char = the_char; new->u.repeated_char.repeat_count = repeat_count; @@ -737,7 +737,7 @@ append_equiv_class (struct Spec_list *list, return false; struct List_element *new = xmalloc (sizeof *new); - new->next = NULL; + new->next = nullptr; new->type = RE_EQUIV_CLASS; new->u.equiv_code = *equiv_class_str; assert (list->tail); @@ -804,7 +804,7 @@ find_bracketed_repeat (const struct E_string *es, size_t start_idx, char const *digit_str = &es->s[start_idx + 2]; char *d_end; if ((xstrtoumax (digit_str, &d_end, *digit_str == '0' ? 8 : 10, - repeat_count, NULL) + repeat_count, nullptr) != LONGINT_OK) || REPEAT_COUNT_MAXIMUM < *repeat_count || digit_str + digit_str_len != d_end) @@ -992,7 +992,7 @@ build_spec_list (const struct E_string *es, struct Spec_list *result) } /* Advance past the current construct. - S->tail must be non-NULL. */ + S->tail must be non-null. */ static void skip_construct (struct Spec_list *s) { @@ -1031,7 +1031,7 @@ get_next (struct Spec_list *s, enum Upper_Lower_class *class) } p = s->tail; - if (p == NULL) + if (p == nullptr) return -1; switch (p->type) @@ -1148,7 +1148,7 @@ card_of_complement (struct Spec_list *s) bool in_set[N_CHARS] = { 0, }; s->state = BEGIN_STATE; - while ((c = get_next (s, NULL)) != -1) + while ((c = get_next (s, nullptr)) != -1) { cardinality -= (!in_set[c]); in_set[c] = true; @@ -1341,7 +1341,7 @@ spec_init (struct Spec_list *spec_list) { struct List_element *new = xmalloc (sizeof *new); spec_list->head = spec_list->tail = new; - spec_list->head->next = NULL; + spec_list->head->next = nullptr; } /* This function makes two passes over the argument string S. The first @@ -1424,10 +1424,10 @@ homogeneous_spec_list (struct Spec_list *s) s->state = BEGIN_STATE; - if ((b = get_next (s, NULL)) == -1) + if ((b = get_next (s, nullptr)) == -1) return false; - while ((c = get_next (s, NULL)) != -1) + while ((c = get_next (s, nullptr)) != -1) if (c != b) return false; @@ -1514,7 +1514,7 @@ validate (struct Spec_list *s1, struct Spec_list *s2) } /* Read buffers of SIZE bytes via the function READER (if READER is - NULL, read from stdin) until EOF. When non-NULL, READER is either + null, read from stdin) until EOF. When non-null, READER is either read_and_delete or read_and_xlate. After each buffer is read, it is processed and written to stdout. The buffers are processed so that multiple consecutive occurrences of the same character in the input @@ -1682,7 +1682,7 @@ set_initialize (struct Spec_list *s, bool complement_this_set, bool *in_set) int c; s->state = BEGIN_STATE; - while ((c = get_next (s, NULL)) != -1) + while ((c = get_next (s, nullptr)) != -1) in_set[c] = true; if (complement_this_set) for (size_t i = 0; i < N_CHARS; i++) @@ -1708,7 +1708,7 @@ main (int argc, char **argv) atexit (close_stdout); - while ((c = getopt_long (argc, argv, "+AcCdst", long_options, NULL)) != -1) + while ((c = getopt_long (argc, argv, "+AcCdst", long_options, nullptr)) != -1) { switch (c) { @@ -1787,7 +1787,7 @@ main (int argc, char **argv) main_exit (EXIT_FAILURE); } else - s2 = NULL; + s2 = nullptr; validate (s1, s2); @@ -1836,7 +1836,7 @@ main (int argc, char **argv) { if (!in_s1[i]) { - int ch = get_next (s2, NULL); + int ch = get_next (s2, nullptr); assert (ch != -1 || truncate_set1); if (ch == -1) { |
