grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v3.11-21-g102be2b


From: Paul Eggert
Subject: grep branch, master, updated. v3.11-21-g102be2b
Date: Thu, 14 Sep 2023 02:01:09 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  102be2bfa571355ff44db39348438a0def1ab382 (commit)
      from  dd8f04957c8cd076fc3d41a83bf1af39f60f4a38 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=102be2bfa571355ff44db39348438a0def1ab382


commit 102be2bfa571355ff44db39348438a0def1ab382
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Thu Sep 14 00:58:45 2023 -0500

    grep: prefer nullptr to NULL
    
    * bootstrap.conf (gnulib_modules): Add nullptr.
    All uses of NULL eliminated or changed to nullptr,
    modernizing us from C89 to C23.

diff --git a/bootstrap.conf b/bootstrap.conf
index a9c6a95..9f1775e 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -73,6 +73,7 @@ memchr
 memchr2
 mempcpy
 minmax
+nullptr
 obstack
 openat-safer
 perl
diff --git a/lib/colorize-w32.c b/lib/colorize-w32.c
index f2df8cc..66201b0 100644
--- a/lib/colorize-w32.c
+++ b/lib/colorize-w32.c
@@ -96,7 +96,7 @@ w32_sgr2attr (const char *sgr_seq)
     {
       if (*p == ';' || *p == '\0')
         {
-          code = strtol (s, NULL, 10);
+          code = strtol (s, nullptr, 10);
           s = p + (*p != '\0');
 
           switch (code)
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 3d586c2..448daf9 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -145,15 +145,15 @@ regex_compile (struct dfa_comp *dc, char const *p, idx_t 
len,
                bool syntax_only)
 {
   struct re_pattern_buffer pat;
-  pat.buffer = NULL;
+  pat.buffer = nullptr;
   pat.allocated = 0;
 
   /* Do not use a fastmap with -i, to work around glibc Bug#20381.  */
   static_assert (UCHAR_MAX < IDX_MAX);
   idx_t uchar_max = UCHAR_MAX;
-  pat.fastmap = (syntax_only | match_icase) ? NULL : ximalloc (uchar_max + 1);
+  pat.fastmap = syntax_only | match_icase ? nullptr : ximalloc (uchar_max + 1);
 
-  pat.translate = NULL;
+  pat.translate = nullptr;
 
   if (syntax_only)
     re_set_syntax (syntax_bits | RE_NO_SUB);
@@ -227,7 +227,7 @@ GEAcompile (char *pattern, idx_t size, reg_syntax_t 
syntax_bits,
   char const *prev = pattern;
 
   /* Buffer containing back-reference-free patterns.  */
-  char *buf = NULL;
+  char *buf = nullptr;
   idx_t buflen = 0;
   idx_t bufalloc = 0;
 
@@ -324,13 +324,13 @@ GEAcompile (char *pattern, idx_t size, reg_syntax_t 
syntax_bits,
       size = total;
     }
   else
-    motif = NULL;
+    motif = nullptr;
 
   dfaparse (pattern, size, dc->dfa);
   kwsmusts (dc);
-  dfacomp (NULL, 0, dc->dfa, 1);
+  dfacomp (nullptr, 0, dc->dfa, 1);
 
-  if (buf != NULL)
+  if (buf)
     {
       if (exact || !dfasupported (dc->dfa))
         {
@@ -424,7 +424,7 @@ EGexecute (void *vdc, char const *buf, idx_t size, idx_t 
*match_size,
                     goto success;
                   if (mb_start < beg)
                     mb_start = beg;
-                  if (mb_goback (&mb_start, NULL, match, buflim) == 0)
+                  if (mb_goback (&mb_start, nullptr, match, buflim) == 0)
                     goto success;
                   /* The matched line starts in the middle of a multibyte
                      character.  Perform the DFA search starting from the
@@ -440,8 +440,8 @@ EGexecute (void *vdc, char const *buf, idx_t size, idx_t 
*match_size,
                  potential matches; this is more likely to be fast
                  than falling back to KWset would be.  */
               next_beg = dfaexec (superset, dfa_beg, (char *) end, 0,
-                                  &count, NULL);
-              if (next_beg == NULL || next_beg == end)
+                                  &count, nullptr);
+              if (!next_beg || next_beg == end)
                 continue;
 
               /* Narrow down to the line we've found.  */
@@ -463,7 +463,7 @@ EGexecute (void *vdc, char const *buf, idx_t size, idx_t 
*match_size,
 
           /* If there's no match, or if we've matched the sentinel,
              we're done.  */
-          if (next_beg == NULL || next_beg == end)
+          if (!next_beg || next_beg == end)
             continue;
 
           /* Narrow down to the line we've found.  */
diff --git a/src/grep.c b/src/grep.c
index 1fa935e..f5b6e50 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -178,7 +178,7 @@ update_patterns (char *keys, idx_t dupfree_size, idx_t size,
 
       intptr_t dst_offset_1 = dst - keys + 1;
       int inserted = hash_insert_if_absent (pattern_table,
-                                            (void *) dst_offset_1, NULL);
+                                            (void *) dst_offset_1, nullptr);
       if (inserted)
         {
           if (inserted < 0)
@@ -425,17 +425,17 @@ color_cap_ne_fct (void)
 static const struct color_cap color_dict[] =
   {
     { "mt", &selected_match_color, color_cap_mt_fct }, /* both ms/mc */
-    { "ms", &selected_match_color, NULL }, /* selected matched text */
-    { "mc", &context_match_color,  NULL }, /* context matched text */
-    { "fn", &filename_color,       NULL }, /* filename */
-    { "ln", &line_num_color,       NULL }, /* line number */
-    { "bn", &byte_num_color,       NULL }, /* byte (sic) offset */
-    { "se", &sep_color,            NULL }, /* separator */
-    { "sl", &selected_line_color,  NULL }, /* selected lines */
-    { "cx", &context_line_color,   NULL }, /* context lines */
-    { "rv", NULL,                  color_cap_rv_fct }, /* -v reverses sl/cx */
-    { "ne", NULL,                  color_cap_ne_fct }, /* no EL on SGR_* */
-    { NULL, NULL,                  NULL }
+    { "ms", &selected_match_color, nullptr }, /* selected matched text */
+    { "mc", &context_match_color,  nullptr }, /* context matched text */
+    { "fn", &filename_color,       nullptr }, /* filename */
+    { "ln", &line_num_color,       nullptr }, /* line number */
+    { "bn", &byte_num_color,       nullptr }, /* byte (sic) offset */
+    { "se", &sep_color,            nullptr }, /* separator */
+    { "sl", &selected_line_color,  nullptr }, /* selected lines */
+    { "cx", &context_line_color,   nullptr }, /* context lines */
+    { "rv", nullptr,               color_cap_rv_fct }, /* -v reverses sl/cx */
+    { "ne", nullptr,               color_cap_ne_fct }, /* no EL on SGR_* */
+    { nullptr, nullptr,            nullptr }
   };
 
 /* Saved errno value from failed output functions on stdout.  */
@@ -503,57 +503,57 @@ enum
 /* Long options equivalences. */
 static struct option const long_options[] =
 {
-  {"basic-regexp",    no_argument, NULL, 'G'},
-  {"extended-regexp", no_argument, NULL, 'E'},
-  {"fixed-regexp",    no_argument, NULL, 'F'},
-  {"fixed-strings",   no_argument, NULL, 'F'},
-  {"perl-regexp",     no_argument, NULL, 'P'},
-  {"after-context", required_argument, NULL, 'A'},
-  {"before-context", required_argument, NULL, 'B'},
-  {"binary-files", required_argument, NULL, BINARY_FILES_OPTION},
-  {"byte-offset", no_argument, NULL, 'b'},
-  {"context", required_argument, NULL, 'C'},
-  {"color", optional_argument, NULL, COLOR_OPTION},
-  {"colour", optional_argument, NULL, COLOR_OPTION},
-  {"count", no_argument, NULL, 'c'},
-  {"devices", required_argument, NULL, 'D'},
-  {"directories", required_argument, NULL, 'd'},
-  {"exclude", required_argument, NULL, EXCLUDE_OPTION},
-  {"exclude-from", required_argument, NULL, EXCLUDE_FROM_OPTION},
-  {"exclude-dir", required_argument, NULL, EXCLUDE_DIRECTORY_OPTION},
-  {"file", required_argument, NULL, 'f'},
-  {"files-with-matches", no_argument, NULL, 'l'},
-  {"files-without-match", no_argument, NULL, 'L'},
-  {"group-separator", required_argument, NULL, GROUP_SEPARATOR_OPTION},
+  {"basic-regexp",    no_argument, nullptr, 'G'},
+  {"extended-regexp", no_argument, nullptr, 'E'},
+  {"fixed-regexp",    no_argument, nullptr, 'F'},
+  {"fixed-strings",   no_argument, nullptr, 'F'},
+  {"perl-regexp",     no_argument, nullptr, 'P'},
+  {"after-context", required_argument, nullptr, 'A'},
+  {"before-context", required_argument, nullptr, 'B'},
+  {"binary-files", required_argument, nullptr, BINARY_FILES_OPTION},
+  {"byte-offset", no_argument, nullptr, 'b'},
+  {"context", required_argument, nullptr, 'C'},
+  {"color", optional_argument, nullptr, COLOR_OPTION},
+  {"colour", optional_argument, nullptr, COLOR_OPTION},
+  {"count", no_argument, nullptr, 'c'},
+  {"devices", required_argument, nullptr, 'D'},
+  {"directories", required_argument, nullptr, 'd'},
+  {"exclude", required_argument, nullptr, EXCLUDE_OPTION},
+  {"exclude-from", required_argument, nullptr, EXCLUDE_FROM_OPTION},
+  {"exclude-dir", required_argument, nullptr, EXCLUDE_DIRECTORY_OPTION},
+  {"file", required_argument, nullptr, 'f'},
+  {"files-with-matches", no_argument, nullptr, 'l'},
+  {"files-without-match", no_argument, nullptr, 'L'},
+  {"group-separator", required_argument, nullptr, GROUP_SEPARATOR_OPTION},
   {"help", no_argument, &show_help, 1},
-  {"include", required_argument, NULL, INCLUDE_OPTION},
-  {"ignore-case", no_argument, NULL, 'i'},
-  {"no-ignore-case", no_argument, NULL, NO_IGNORE_CASE_OPTION},
-  {"initial-tab", no_argument, NULL, 'T'},
-  {"label", required_argument, NULL, LABEL_OPTION},
-  {"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION},
-  {"line-number", no_argument, NULL, 'n'},
-  {"line-regexp", no_argument, NULL, 'x'},
-  {"max-count", required_argument, NULL, 'm'},
-
-  {"no-filename", no_argument, NULL, 'h'},
-  {"no-group-separator", no_argument, NULL, GROUP_SEPARATOR_OPTION},
-  {"no-messages", no_argument, NULL, 's'},
-  {"null", no_argument, NULL, 'Z'},
-  {"null-data", no_argument, NULL, 'z'},
-  {"only-matching", no_argument, NULL, 'o'},
-  {"quiet", no_argument, NULL, 'q'},
-  {"recursive", no_argument, NULL, 'r'},
-  {"dereference-recursive", no_argument, NULL, 'R'},
-  {"regexp", required_argument, NULL, 'e'},
-  {"invert-match", no_argument, NULL, 'v'},
-  {"silent", no_argument, NULL, 'q'},
-  {"text", no_argument, NULL, 'a'},
-  {"binary", no_argument, NULL, 'U'},
-  {"unix-byte-offsets", no_argument, NULL, 'u'},
-  {"version", no_argument, NULL, 'V'},
-  {"with-filename", no_argument, NULL, 'H'},
-  {"word-regexp", no_argument, NULL, 'w'},
+  {"include", required_argument, nullptr, INCLUDE_OPTION},
+  {"ignore-case", no_argument, nullptr, 'i'},
+  {"no-ignore-case", no_argument, nullptr, NO_IGNORE_CASE_OPTION},
+  {"initial-tab", no_argument, nullptr, 'T'},
+  {"label", required_argument, nullptr, LABEL_OPTION},
+  {"line-buffered", no_argument, nullptr, LINE_BUFFERED_OPTION},
+  {"line-number", no_argument, nullptr, 'n'},
+  {"line-regexp", no_argument, nullptr, 'x'},
+  {"max-count", required_argument, nullptr, 'm'},
+
+  {"no-filename", no_argument, nullptr, 'h'},
+  {"no-group-separator", no_argument, nullptr, GROUP_SEPARATOR_OPTION},
+  {"no-messages", no_argument, nullptr, 's'},
+  {"null", no_argument, nullptr, 'Z'},
+  {"null-data", no_argument, nullptr, 'z'},
+  {"only-matching", no_argument, nullptr, 'o'},
+  {"quiet", no_argument, nullptr, 'q'},
+  {"recursive", no_argument, nullptr, 'r'},
+  {"dereference-recursive", no_argument, nullptr, 'R'},
+  {"regexp", required_argument, nullptr, 'e'},
+  {"invert-match", no_argument, nullptr, 'v'},
+  {"silent", no_argument, nullptr, 'q'},
+  {"text", no_argument, nullptr, 'a'},
+  {"binary", no_argument, nullptr, 'U'},
+  {"unix-byte-offsets", no_argument, nullptr, 'u'},
+  {"version", no_argument, nullptr, 'V'},
+  {"with-filename", no_argument, nullptr, 'H'},
+  {"word-regexp", no_argument, nullptr, 'w'},
   {0, 0, 0, 0}
 };
 
@@ -584,7 +584,7 @@ enum directories_type
 /* How to handle directories.  */
 static char const *const directories_args[] =
 {
-  "read", "recurse", "skip", NULL
+  "read", "recurse", "skip", nullptr
 };
 static enum directories_type const directories_types[] =
 {
@@ -986,7 +986,7 @@ fillbuf (idx_t save, struct stat const *st)
                 alloc_max = MAX (a, bufalloc + incr_min);
             }
 
-          newbuf = xpalloc (NULL, &bufalloc, incr_min, alloc_max, 1);
+          newbuf = xpalloc (nullptr, &bufalloc, incr_min, alloc_max, 1);
         }
 
       readbuf = ALIGN_TO (newbuf + 1 + save, pagesize);
@@ -1087,14 +1087,14 @@ static bool count_matches;      /* Count matching 
lines.  */
 static intmax_t max_count;     /* Max number of selected
                                    lines from an input file.  */
 static bool line_buffered;     /* Use line buffering.  */
-static char *label = NULL;      /* Fake filename for stdin */
+static char *label;            /* Fake filename for stdin */
 
 
 /* Internal variables to keep track of byte count, context, etc. */
 static intmax_t totalcc;       /* Total character count before bufbeg. */
 static char const *lastnl;     /* Pointer after last newline counted. */
 static char *lastout;          /* Pointer after last character output;
-                                   NULL if no character has been output
+                                   null if no character has been output
                                    or if it's conceptually before bufbeg. */
 static intmax_t outleft;       /* Maximum number of selected lines.  */
 static intmax_t pending;       /* Pending lines of output.
@@ -1211,7 +1211,7 @@ print_line_middle (char *beg, char *lim,
   idx_t match_size;
   ptrdiff_t match_offset;
   char *cur;
-  char *mid = NULL;
+  char *mid = nullptr;
   char *b;
 
   for (cur = beg;
@@ -1243,7 +1243,7 @@ print_line_middle (char *beg, char *lim,
             {
               char sep = out_invert ? SEP_CHAR_REJECTED : SEP_CHAR_SELECTED;
               if (! print_line_head (b, match_size, lim, sep))
-                return NULL;
+                return nullptr;
             }
           else
             {
@@ -1251,7 +1251,7 @@ print_line_middle (char *beg, char *lim,
               if (mid)
                 {
                   cur = mid;
-                  mid = NULL;
+                  mid = nullptr;
                 }
               fwrite_errno (cur, 1, b - cur);
             }
@@ -1315,7 +1315,7 @@ prline (char *beg, char *lim, char sep)
                      ? selected_match_color : context_match_color);
     }
   else
-    line_color = match_color = NULL; /* Shouldn't be used.  */
+    line_color = match_color = nullptr; /* Shouldn't be used.  */
 
   if ((only_matching && matching)
       || (color_option && (*line_color || *match_color)))
@@ -1466,7 +1466,7 @@ grepbuf (char *beg, char const *lim)
     {
       idx_t match_size;
       ptrdiff_t match_offset = execute (compiled_pattern, p, lim - p,
-                                        &match_size, NULL);
+                                        &match_size, nullptr);
       if (match_offset < 0)
         {
           if (!out_invert)
@@ -1584,7 +1584,7 @@ grep (int fd, struct stat const *st, bool *ineof)
       oldc = beg[-1];
       beg[-1] = eol;
       /* If rawmemrchr existed it could be used here, since we have ensured
-         that this use of memrchr is guaranteed never to return NULL.  */
+         that this use of memrchr is guaranteed never to return nullptr.  */
       lim = memrchr (beg - 1, eol, buflim - beg + 1);
       ++lim;
       beg[-1] = oldc;
@@ -1776,12 +1776,12 @@ drain_input (int fd, struct stat const *st)
     {
 #ifdef SPLICE_F_MOVE
       /* Should be faster, since it need not copy data to user space.  */
-      nbytes = splice (fd, NULL, STDOUT_FILENO, NULL,
+      nbytes = splice (fd, nullptr, STDOUT_FILENO, nullptr,
                        INITIAL_BUFSIZE, SPLICE_F_MOVE);
       if (0 <= nbytes || errno != EINVAL)
         {
           while (0 < nbytes)
-            nbytes = splice (fd, NULL, STDOUT_FILENO, NULL,
+            nbytes = splice (fd, nullptr, STDOUT_FILENO, nullptr,
                              INITIAL_BUFSIZE, SPLICE_F_MOVE);
           return nbytes == 0;
         }
@@ -1864,8 +1864,8 @@ grepdesc (int desc, bool command_line)
         suppressible_error (errno);
 
       fts_arg[0] = (char *) filename;
-      fts_arg[1] = NULL;
-      fts = fts_open (fts_arg, opts, NULL);
+      fts_arg[1] = nullptr;
+      fts = fts_open (fts_arg, opts, nullptr);
 
       if (!fts)
         xalloc_die ();
@@ -2132,7 +2132,7 @@ get_nondigit_option (int argc, char *const *argv, 
intmax_t *default_context)
   while (true)
     {
       opt = getopt_long (argc, (char **) argv, short_options,
-                         long_options, NULL);
+                         long_options, nullptr);
       if (! c_isdigit (opt))
         break;
 
@@ -2185,14 +2185,14 @@ parse_grep_colors (void)
   char *val;
 
   p = getenv ("GREP_COLORS"); /* Plural! */
-  if (p == NULL || *p == '\0')
+  if (!p || *p == '\0')
     return;
 
   /* Work off a writable copy.  */
   q = xstrdup (p);
 
   name = q;
-  val = NULL;
+  val = nullptr;
   /* From now on, be well-formed or you're gone.  */
   for (;;)
     if (*q == ':' || *q == '\0')
@@ -2214,7 +2214,7 @@ parse_grep_colors (void)
         if (c == '\0')
           return;
         name = q;
-        val = NULL;
+        val = nullptr;
       }
     else if (*q == '=')
       {
@@ -2223,7 +2223,7 @@ parse_grep_colors (void)
         *q++ = '\0'; /* Terminate name.  */
         val = q; /* Can be the empty string.  */
       }
-    else if (val == NULL)
+    else if (!val)
       q++; /* Accumulate name.  */
     else if (*q == ';' || c_isdigit (*q))
       q++; /* Accumulate val.  Protect the terminal from being sent crap.  */
@@ -2461,7 +2461,7 @@ try_fgrep_pattern (int matcher, char *keys, idx_t *len_p)
 int
 main (int argc, char **argv)
 {
-  char *keys = NULL;
+  char *keys = nullptr;
   idx_t keycc = 0, keyalloc = 0;
   int matcher = -1;
   int opt;
@@ -2499,7 +2499,7 @@ main (int argc, char **argv)
   init_localeinfo (&localeinfo);
 
   atexit (clean_up_stdout);
-  c_stack_action (NULL);
+  c_stack_action (nullptr);
 
   last_recursive = 0;
 
@@ -2827,7 +2827,7 @@ main (int argc, char **argv)
   if (show_version)
     {
       version_etc (stdout, getprogname (), PACKAGE_NAME, VERSION,
-                   (char *) NULL);
+                   (char *) nullptr);
       puts (_("Written by Mike Haertel and others; see\n"
               "<https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>."));
 #if HAVE_LIBPCRE
@@ -2921,7 +2921,7 @@ main (int argc, char **argv)
     {
       /* Legacy.  */
       char *userval = getenv ("GREP_COLOR");
-      if (userval != NULL && *userval != '\0')
+      if (userval && *userval)
         for (char *q = userval; *q == ';' || c_isdigit (*q); q++)
           if (!q[1])
             {
@@ -2980,8 +2980,8 @@ main (int argc, char **argv)
   /* We need one byte prior and one after.  */
   char eolbytes[3] = { 0, eolbyte, 0 };
   idx_t match_size;
-  skip_empty_lines = ((execute (compiled_pattern, eolbytes + 1, 1,
-                                &match_size, NULL) == 0)
+  skip_empty_lines = (!execute (compiled_pattern, eolbytes + 1, 1,
+                                &match_size, nullptr)
                       == out_invert);
 
   int num_operands = argc - optind;
@@ -3014,20 +3014,20 @@ main (int argc, char **argv)
     }
   else if (directories == RECURSE_DIRECTORIES && 0 < last_recursive)
     {
-      static char *const cwd_only[] = { (char *) ".", NULL };
+      static char *const cwd_only[] = { (char *) ".", nullptr };
       files = cwd_only;
       omit_dot_slash = true;
     }
   else
     {
-      static char *const stdin_only[] = { (char *) "-", NULL };
+      static char *const stdin_only[] = { (char *) "-", nullptr };
       files = stdin_only;
     }
 
   bool status = true;
   do
     status &= grep_command_line_arg (*files++);
-  while (*files != NULL);
+  while (*files);
 
   return errseen ? EXIT_TROUBLE : status;
 }
diff --git a/src/kwsearch.c b/src/kwsearch.c
index 212f6e6..161a2d3 100644
--- a/src/kwsearch.c
+++ b/src/kwsearch.c
@@ -50,7 +50,7 @@ void *
 Fcompile (char *pattern, idx_t size, reg_syntax_t ignored, bool exact)
 {
   kwset_t kwset;
-  char *buf = NULL;
+  char *buf = nullptr;
   idx_t bufalloc = 0;
 
   kwset = kwsinit (true);
@@ -71,7 +71,7 @@ Fcompile (char *pattern, idx_t size, reg_syntax_t ignored, 
bool exact)
                 {
                   free (buf);
                   bufalloc = len;
-                  buf = xpalloc (NULL, &bufalloc, 2, -1, 1);
+                  buf = xpalloc (nullptr, &bufalloc, 2, -1, 1);
                   buf[0] = eolbyte;
                 }
               memcpy (buf + 1, p, len);
@@ -96,7 +96,7 @@ Fcompile (char *pattern, idx_t size, reg_syntax_t ignored, 
bool exact)
   kwsearch->words = words;
   kwsearch->pattern = pattern;
   kwsearch->size = size;
-  kwsearch->re = NULL;
+  kwsearch->re = nullptr;
   return kwsearch;
 }
 
@@ -151,7 +151,7 @@ Fexecute (void *vcp, char const *buf, idx_t size, idx_t 
*match_size,
         goto success_in_beg_and_len;
       if (match_lines)
         {
-          len += start_ptr == NULL;
+          len += !start_ptr;
           goto success_in_beg_and_len;
         }
       if (! match_words)
@@ -199,7 +199,7 @@ Fexecute (void *vcp, char const *buf, idx_t size, idx_t 
*match_size,
                   end = buf + size;
 
                 if (0 <= EGexecute (kwsearch->re, beg, end - beg,
-                                    match_size, NULL))
+                                    match_size, nullptr))
                   goto success_match_words;
                 beg = end - 1;
                 break;
diff --git a/src/kwset.c b/src/kwset.c
index b885ef9..b458227 100644
--- a/src/kwset.c
+++ b/src/kwset.c
@@ -136,14 +136,14 @@ kwsalloc (char const *trans)
   kwset->words = 0;
   kwset->trie = obstack_alloc (&kwset->obstack, sizeof *kwset->trie);
   kwset->trie->accepting = 0;
-  kwset->trie->links = NULL;
-  kwset->trie->parent = NULL;
-  kwset->trie->next = NULL;
-  kwset->trie->fail = NULL;
+  kwset->trie->links = nullptr;
+  kwset->trie->parent = nullptr;
+  kwset->trie->next = nullptr;
+  kwset->trie->fail = nullptr;
   kwset->trie->depth = 0;
   kwset->trie->shift = 0;
   kwset->mind = IDX_MAX;
-  kwset->target = NULL;
+  kwset->target = nullptr;
   kwset->trans = trans;
   kwset->kwsexec = acexec;
 
@@ -198,14 +198,14 @@ kwsincr (kwset_t kwset, char const *text, idx_t len)
       if (!cur)
         {
           cur = obstack_alloc (&kwset->obstack, sizeof *cur);
-          cur->llink = NULL;
-          cur->rlink = NULL;
+          cur->llink = nullptr;
+          cur->rlink = nullptr;
           cur->trie = obstack_alloc (&kwset->obstack, sizeof *cur->trie);
           cur->trie->accepting = 0;
-          cur->trie->links = NULL;
+          cur->trie->links = nullptr;
           cur->trie->parent = trie;
-          cur->trie->next = NULL;
-          cur->trie->fail = NULL;
+          cur->trie->next = nullptr;
+          cur->trie->fail = nullptr;
           cur->trie->depth = trie->depth + 1;
           cur->trie->shift = 0;
           cur->label = label;
@@ -431,7 +431,7 @@ kwsprep (kwset_t kwset)
       new_kwset = kwsalloc (kwset->trans);
       new_kwset->kwsexec = bmexec;
       kwsincr (new_kwset, kwset->target, kwset->mind);
-      obstack_free (&kwset->obstack, NULL);
+      obstack_free (&kwset->obstack, nullptr);
       *kwset = *new_kwset;
       free (new_kwset);
     }
@@ -618,7 +618,7 @@ bm_delta2_search (char const **tpp, char const *ep, char 
const *sp,
 }
 
 /* Return the address of the first byte in the buffer S (of size N)
-   that matches the terminal byte specified by KWSET, or NULL if there
+   that matches the terminal byte specified by KWSET, or null if there
    is no match.  KWSET->gc1 should be nonnegative.  */
 static char const *
 memchr_kwset (char const *s, idx_t n, kwset_t kwset)
@@ -643,7 +643,7 @@ memchr_kwset (char const *s, idx_t n, kwset_t kwset)
             return memchr2 (s, kwset->gc1, kwset->gc1help, slim - s);
         }
     }
-  return NULL;
+  return nullptr;
 }
 
 /* Fast Boyer-Moore search (inlinable version).  */
@@ -725,7 +725,7 @@ bmexec_trans (kwset_t kwset, char const *text, idx_t size)
       d = d1[U((tp += d)[-1])];
       if (d != 0)
         continue;
-      if (bm_delta2_search (&tp, ep, sp, len, trans, gc1, gc2, NULL, kwset))
+      if (bm_delta2_search (&tp, ep, sp, len, trans, gc1, gc2, nullptr, kwset))
         return tp - text;
     }
 
@@ -907,6 +907,6 @@ kwsexec (kwset_t kwset, char const *text, idx_t size,
 void
 kwsfree (kwset_t kwset)
 {
-  obstack_free (&kwset->obstack, NULL);
+  obstack_free (&kwset->obstack, nullptr);
   free (kwset);
 }
diff --git a/src/pcresearch.c b/src/pcresearch.c
index eabe5fe..54a1690 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -86,7 +86,7 @@ private_free (void *ptr, _GL_UNUSED void *unused)
 void
 Pprint_version (void)
 {
-  char *buf = ximalloc (pcre2_config (PCRE2_CONFIG_VERSION, NULL));
+  char *buf = ximalloc (pcre2_config (PCRE2_CONFIG_VERSION, nullptr));
   pcre2_config (PCRE2_CONFIG_VERSION, buf);
   printf (_("\ngrep -P uses PCRE2 %s\n"), buf);
   free (buf);
@@ -122,7 +122,7 @@ jit_exec (struct pcre_comp *pc, char const *subject, idx_t 
search_bytes,
             xalloc_die ();
           if (!pc->mcontext)
             pc->mcontext = pcre2_match_context_create (pc->gcontext);
-          pcre2_jit_stack_assign (pc->mcontext, NULL, pc->jit_stack);
+          pcre2_jit_stack_assign (pc->mcontext, nullptr, pc->jit_stack);
         }
       else if (e == PCRE2_ERROR_DEPTHLIMIT)
         {
@@ -158,7 +158,7 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, 
bool exact)
   char *patlim = pattern + size;
   struct pcre_comp *pc = ximalloc (sizeof *pc);
   pcre2_general_context *gcontext = pc->gcontext
-    = pcre2_general_context_create (private_malloc, private_free, NULL);
+    = pcre2_general_context_create (private_malloc, private_free, nullptr);
   pcre2_compile_context *ccontext = pcre2_compile_context_create (gcontext);
 
   if (localeinfo.multibyte)
@@ -199,7 +199,7 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, 
bool exact)
   pcre2_set_compile_extra_options (ccontext, extra_options);
 #endif
 
-  void *re_storage = NULL;
+  void *re_storage = nullptr;
   if (match_lines)
     {
 #ifndef PCRE2_EXTRA_MATCH_LINE
@@ -245,7 +245,7 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, 
bool exact)
   free (re_storage);
   pcre2_compile_context_free (ccontext);
 
-  pc->mcontext = NULL;
+  pc->mcontext = nullptr;
   pc->data = pcre2_match_data_create_from_pattern (pc->cre, gcontext);
 
   /* Ignore any failure return from pcre2_jit_compile, as that merely
@@ -253,7 +253,7 @@ Pcompile (char *pattern, idx_t size, reg_syntax_t ignored, 
bool exact)
   pcre2_jit_compile (pc->cre, PCRE2_JIT_COMPLETE);
 
   /* The PCRE documentation says that a 32 KiB stack is the default.  */
-  pc->jit_stack = NULL;
+  pc->jit_stack = nullptr;
   pc->jit_stack_size = 32 << 10;
 
   pc->empty_match[false] = jit_exec (pc, "", 0, 0, PCRE2_NOTBOL);
diff --git a/src/searchutils.c b/src/searchutils.c
index 68d7a67..0122560 100644
--- a/src/searchutils.c
+++ b/src/searchutils.c
@@ -45,7 +45,7 @@ wordinit (void)
 kwset_t
 kwsinit (bool mb_trans)
 {
-  char *trans = NULL;
+  char *trans = nullptr;
 
   if (match_icase && (MB_CUR_MAX == 1 || mb_trans))
     {
@@ -216,6 +216,6 @@ wordchar_prev (char const *buf, char const *cur, char const 
*end)
   if (! localeinfo.multibyte || localeinfo.using_utf8 & ~(b >> 7))
     return sbwordchar[b];
   char const *p = buf;
-  cur -= mb_goback (&p, NULL, cur, end);
+  cur -= mb_goback (&p, nullptr, cur, end);
   return wordchar_next (cur, end);
 }

-----------------------------------------------------------------------

Summary of changes:
 bootstrap.conf     |   1 +
 lib/colorize-w32.c |   2 +-
 src/dfasearch.c    |  22 +++----
 src/grep.c         | 180 ++++++++++++++++++++++++++---------------------------
 src/kwsearch.c     |  10 +--
 src/kwset.c        |  30 ++++-----
 src/pcresearch.c   |  12 ++--
 src/searchutils.c  |   4 +-
 8 files changed, 131 insertions(+), 130 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]