texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/macro.c (handle_macro):


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/macro.c (handle_macro): use strchrnul instead of strchr to have more common code.
Date: Mon, 27 May 2024 15:14:51 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new eeb1ffe669 * tp/Texinfo/XS/parsetexi/macro.c (handle_macro): use 
strchrnul instead of strchr to have more common code.
eeb1ffe669 is described below

commit eeb1ffe6690cf779087b34bb05676ba6cfc23a84
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon May 27 21:14:38 2024 +0200

    * tp/Texinfo/XS/parsetexi/macro.c (handle_macro): use strchrnul
    instead of strchr to have more common code.
---
 ChangeLog                       |  5 +++++
 tp/Texinfo/XS/parsetexi/macro.c | 10 +++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 87792a4489..c56c1e3b42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-05-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/macro.c (handle_macro): use strchrnul
+       instead of strchr to have more common code.
+
 2024-05-27  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_abort_empty_line),
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index bdcf34c0fa..4a530dbc81 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -934,16 +934,12 @@ handle_macro (ELEMENT *current, const char **line_inout, 
enum command_id cmd)
                     }
                   if (! leading_spaces_added)
                     {
-                      char *p = strchr (line, '\n');
+                      const char *p = strchrnul (line, '\n');
+                      arg_elt = merge_text (arg_elt, line, (p - line), 0);
                       if (!p)
-                        {
-                          size_t line_len = strlen (line);
-                          arg_elt = merge_text (arg_elt, line, line_len, 0);
-                          line += line_len;
-                        }
+                        line = p;
                       else
                         {
-                          arg_elt = merge_text (arg_elt, line, (p - line), 0);
                           line = "\n";
                           break;
                         }



reply via email to

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