texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 08:34:55 -0400 (EDT)

branch: master
commit 526da18657799ef926bc15c07a796ca24ebc93fa
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jun 24 21:35:08 2024 +0200

    * tp/Texinfo/XS/main/convert_to_text.h (TEXT_OPTIONS): use size_t for
    document_descriptor.
    
    * tp/Texinfo/XS/parsetexi/parser.c (parse_texi_document): return void.
    
    * tp/Texinfo/XS/convert/convert_html.c,
    tp/Texinfo/XS/main/DocumentXS.xs,
    tp/Texinfo/XS/main/build_perl_info.c, tp/Texinfo/XS/main/document.c,
    tp/Texinfo/XS/main/get_perl_info.c, tp/Texinfo/XS/main/translations.c,
    tp/Texinfo/XS/parsetexi/Parsetexi.xs, tp/Texinfo/XS/parsetexi/api.c,
    tp/Texinfo/XS/parsetexi/parser.c: use size_t more for document
    descriptors.
---
 ChangeLog                            | 15 +++++++++++++++
 tp/Texinfo/XS/convert/convert_html.c | 14 +++++++-------
 tp/Texinfo/XS/main/DocumentXS.xs     |  6 ++++--
 tp/Texinfo/XS/main/build_perl_info.c |  3 ++-
 tp/Texinfo/XS/main/build_perl_info.h |  2 +-
 tp/Texinfo/XS/main/convert_to_text.h |  4 +++-
 tp/Texinfo/XS/main/document.c        | 14 +++++++-------
 tp/Texinfo/XS/main/document.h        | 10 +++++-----
 tp/Texinfo/XS/main/get_perl_info.c   |  7 ++++---
 tp/Texinfo/XS/main/translations.c    | 15 ++++++++-------
 tp/Texinfo/XS/main/translations.h    | 12 ++++++------
 tp/Texinfo/XS/parsetexi/Parsetexi.xs | 18 ++++++++++--------
 tp/Texinfo/XS/parsetexi/api.c        |  8 ++++----
 tp/Texinfo/XS/parsetexi/api.h        |  8 ++++----
 tp/Texinfo/XS/parsetexi/parser.c     | 18 ++++++++++--------
 tp/Texinfo/XS/parsetexi/parser.h     |  4 ++--
 16 files changed, 92 insertions(+), 66 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dd2756e0b6..8ea7ecea8f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2024-06-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/convert_to_text.h (TEXT_OPTIONS): use size_t for
+       document_descriptor.
+
+       * tp/Texinfo/XS/parsetexi/parser.c (parse_texi_document): return void.
+
+       * tp/Texinfo/XS/convert/convert_html.c,
+       tp/Texinfo/XS/main/DocumentXS.xs,
+       tp/Texinfo/XS/main/build_perl_info.c, tp/Texinfo/XS/main/document.c,
+       tp/Texinfo/XS/main/get_perl_info.c, tp/Texinfo/XS/main/translations.c, 
+       tp/Texinfo/XS/parsetexi/Parsetexi.xs, tp/Texinfo/XS/parsetexi/api.c,
+       tp/Texinfo/XS/parsetexi/parser.c: use size_t more for document
+       descriptors.
+
 2024-06-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/main/targets.c, tp/Texinfo/XS/parsetexi/labels.c
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 12598606ff..758268781e 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -624,14 +624,14 @@ html_translate_string (CONVERTER *self, const char 
*string,
 
 /* returns a document descriptor. */
 /* same as gdt with html_translate_string called instead of translate_string */
-int
+size_t
 html_gdt (const char *string, CONVERTER *self, const char *lang,
-     NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-     const char *translation_context)
+          NAMED_STRING_ELEMENT_LIST *replaced_substrings,
+          const char *translation_context)
 {
   const OPTIONS *options = self->conf;
   int debug_level = 0;
-  int document_descriptor;
+  size_t document_descriptor;
 
   char *translated_string = html_translate_string (self, string, lang,
                                                    translation_context);
@@ -639,8 +639,8 @@ html_gdt (const char *string, CONVERTER *self, const char 
*lang,
   if (options && options->DEBUG.o.integer >= 0)
     debug_level = options->DEBUG.o.integer;
 
-  document_descriptor  = replace_convert_substrings (translated_string,
-                                  replaced_substrings, debug_level);
+  document_descriptor = replace_convert_substrings (translated_string,
+                                    replaced_substrings, debug_level);
   free (translated_string);
   return document_descriptor;
 }
@@ -653,7 +653,7 @@ html_gdt_tree (const char *string, CONVERTER *self,
 {
   DOCUMENT *document = self->document;
 
-  int gdt_document_descriptor = html_gdt (string, self, lang,
+  size_t gdt_document_descriptor = html_gdt (string, self, lang,
                                      replaced_substrings, translation_context);
 
   ELEMENT *tree
diff --git a/tp/Texinfo/XS/main/DocumentXS.xs b/tp/Texinfo/XS/main/DocumentXS.xs
index 56fd76985c..9a204e8ddb 100644
--- a/tp/Texinfo/XS/main/DocumentXS.xs
+++ b/tp/Texinfo/XS/main/DocumentXS.xs
@@ -15,6 +15,8 @@
 
 #include <config.h>
 
+#include <stddef.h>
+
 /* Avoid namespace conflicts. */
 #define context perl_context
 
@@ -93,7 +95,7 @@ rebuild_tree (SV *tree_in, ...)
         RETVAL
 
 void
-remove_document_descriptor (int document_descriptor)
+remove_document_descriptor (size_t document_descriptor)
 
 void
 remove_document (SV *document_in)
@@ -370,7 +372,7 @@ gdt (string, ...)
         HV *hv_replaced_substrings = 0;
         NAMED_STRING_ELEMENT_LIST *replaced_substrings = 0;
         HV *result_tree;
-        int gdt_document_descriptor;
+        size_t gdt_document_descriptor;
         DOCUMENT *gdt_document;
       CODE:
         if (items > 1 && SvOK(ST(1)))
diff --git a/tp/Texinfo/XS/main/build_perl_info.c 
b/tp/Texinfo/XS/main/build_perl_info.c
index d7c384fdf3..fe3ed072d7 100644
--- a/tp/Texinfo/XS/main/build_perl_info.c
+++ b/tp/Texinfo/XS/main/build_perl_info.c
@@ -17,6 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
+#include <stddef.h>
 
 /* Avoid namespace conflicts. */
 #define context perl_context
@@ -1577,7 +1578,7 @@ pass_errors_to_registrar (const ERROR_MESSAGE_LIST 
*error_messages,
 }
 
 void
-pass_document_parser_errors_to_registrar (int document_descriptor,
+pass_document_parser_errors_to_registrar (size_t document_descriptor,
                                           SV *parser_sv)
 {
   DOCUMENT *document;
diff --git a/tp/Texinfo/XS/main/build_perl_info.h 
b/tp/Texinfo/XS/main/build_perl_info.h
index 259e6d753c..f1ee7a9ab8 100644
--- a/tp/Texinfo/XS/main/build_perl_info.h
+++ b/tp/Texinfo/XS/main/build_perl_info.h
@@ -55,7 +55,7 @@ SV *document_labels_list (SV *document_in);
 
 SV *document_global_information (SV *document_in);
 
-void pass_document_parser_errors_to_registrar (int document_descriptor,
+void pass_document_parser_errors_to_registrar (size_t document_descriptor,
                                                SV *parser_sv);
 SV *pass_errors_to_registrar (const ERROR_MESSAGE_LIST *error_messages,
                               SV *object_sv,
diff --git a/tp/Texinfo/XS/main/convert_to_text.h 
b/tp/Texinfo/XS/main/convert_to_text.h
index da096f1413..5fbb633f70 100644
--- a/tp/Texinfo/XS/main/convert_to_text.h
+++ b/tp/Texinfo/XS/main/convert_to_text.h
@@ -2,6 +2,8 @@
 #ifndef CONVERT_TO_TEXT_H
 #define CONVERT_TO_TEXT_H
 
+#include <stddef.h>
+
 #include "options_types.h"
 #include "tree_types.h"
 #include "document_types.h"
@@ -28,7 +30,7 @@ typedef struct TEXT_OPTIONS {
       in which case other_options is set */
     OPTIONS *self_converter_options; /* text converter options available
                                         as the OPTIONS structure */
-    int document_descriptor;
+    size_t document_descriptor;
 } TEXT_OPTIONS;
 
 char *convert_to_text (const ELEMENT *root, TEXT_OPTIONS *text_options);
diff --git a/tp/Texinfo/XS/main/document.c b/tp/Texinfo/XS/main/document.c
index 6c2cbd0263..ff8400afde 100644
--- a/tp/Texinfo/XS/main/document.c
+++ b/tp/Texinfo/XS/main/document.c
@@ -39,7 +39,7 @@ static size_t document_number;
 static size_t document_space;
 
 DOCUMENT *
-retrieve_document (int document_descriptor)
+retrieve_document (size_t document_descriptor)
 {
   if (document_descriptor <= document_number
       && document_list[document_descriptor -1] != 0)
@@ -454,7 +454,7 @@ destroy_document_information_except_tree (DOCUMENT 
*document)
 }
 
 void
-remove_document_descriptor (int document_descriptor)
+remove_document_descriptor (size_t document_descriptor)
 {
   DOCUMENT *document = 0;
 
@@ -474,7 +474,7 @@ remove_document_descriptor (int document_descriptor)
     destroy_strings_list (document->small_strings);
 
   /*
-  fprintf (stderr, "REMOVE %d %p\n", document_descriptor, document);
+  fprintf (stderr, "REMOVE %zu %p\n", document_descriptor, document);
    */
 
   free (document);
@@ -484,7 +484,7 @@ remove_document_descriptor (int document_descriptor)
 /* destroy everything except for the tree and merge small string to
    DOCUMENT */
 ELEMENT *
-unregister_document_merge_with_document (int document_descriptor,
+unregister_document_merge_with_document (size_t document_descriptor,
                                          DOCUMENT *document)
 {
   DOCUMENT *removed_document = retrieve_document (document_descriptor);
@@ -499,7 +499,7 @@ unregister_document_merge_with_document (int 
document_descriptor,
   removed_document->tree = 0;
 
   /*
-  fprintf (stderr, "UNREGISTER %p (%d)\n", removed_document,
+  fprintf (stderr, "UNREGISTER %p (%zu)\n", removed_document,
                                            document_descriptor);
    */
 
@@ -549,7 +549,7 @@ add_other_global_info_string (OTHER_GLOBAL_INFO 
*other_global_info,
 
 /* does not seems to be used */
 void
-wipe_document_errors (int document_descriptor)
+wipe_document_errors (size_t document_descriptor)
 {
   DOCUMENT *document = retrieve_document (document_descriptor);
   if (document)
@@ -557,7 +557,7 @@ wipe_document_errors (int document_descriptor)
 }
 
 void
-wipe_document_parser_errors (int document_descriptor)
+wipe_document_parser_errors (size_t document_descriptor)
 {
   DOCUMENT *document = retrieve_document (document_descriptor);
   if (document)
diff --git a/tp/Texinfo/XS/main/document.h b/tp/Texinfo/XS/main/document.h
index 07ba1b1f95..1deb13ee10 100644
--- a/tp/Texinfo/XS/main/document.h
+++ b/tp/Texinfo/XS/main/document.h
@@ -12,7 +12,7 @@
 struct TEXT_OPTIONS;
 
 
-DOCUMENT *retrieve_document (int document_descriptor);
+DOCUMENT *retrieve_document (size_t document_descriptor);
 DOCUMENT *new_document (void);
 void register_document_nodes_list (DOCUMENT *document,
                                    ELEMENT_LIST *nodes_list);
@@ -41,14 +41,14 @@ COLLATION_INDICES_SORTED_BY_LETTER 
*sorted_indices_by_letter (
                           const char *collation_language,
                           const char *collation_locale);
 
-void remove_document_descriptor (int document_descriptor);
-ELEMENT *unregister_document_merge_with_document (int document_descriptor,
+void remove_document_descriptor (size_t document_descriptor);
+ELEMENT *unregister_document_merge_with_document (size_t document_descriptor,
                                                   DOCUMENT *document);
 
 void add_other_global_info_string (OTHER_GLOBAL_INFO *other_global_info,
                                    const char *key, const char *value);
 
-void wipe_document_parser_errors (int document_descriptor);
-void wipe_document_errors (int document_descriptor);
+void wipe_document_parser_errors (size_t document_descriptor);
+void wipe_document_errors (size_t document_descriptor);
 
 #endif
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index bbaf0f3ae7..702a47cce7 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -112,7 +112,7 @@ debug_print_element_sv (SV *element_sv)
 DOCUMENT *
 get_document_or_warn (SV *sv_in, char *key, char *warn_string)
 {
-  int document_descriptor;
+  size_t document_descriptor;
   DOCUMENT *document = 0;
   SV** document_descriptor_sv;
   HV *hv_in;
@@ -128,7 +128,8 @@ get_document_or_warn (SV *sv_in, char *key, char 
*warn_string)
   document_descriptor_sv = hv_fetch (hv_in, key, strlen (key), 0);
   if (document_descriptor_sv && SvOK (*document_descriptor_sv))
     {
-      document_descriptor = SvIV (*document_descriptor_sv);
+      /* NOTE if size_t size is more than IV we could have overflow here */
+      document_descriptor = (size_t) SvIV (*document_descriptor_sv);
       document = retrieve_document (document_descriptor);
     }
   else if (warn_string)
@@ -138,7 +139,7 @@ get_document_or_warn (SV *sv_in, char *key, char 
*warn_string)
     }
   if (! document && warn_string)
     {
-      fprintf (stderr, "ERROR: %s: no document %d\n", warn_string,
+      fprintf (stderr, "ERROR: %s: no document %zu\n", warn_string,
                                                       document_descriptor);
     }
   return document;
diff --git a/tp/Texinfo/XS/main/translations.c 
b/tp/Texinfo/XS/main/translations.c
index 038a9b1a2c..eb23525b2c 100644
--- a/tp/Texinfo/XS/main/translations.c
+++ b/tp/Texinfo/XS/main/translations.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 #include <locale.h>
 #include <errno.h>
+#include <stddef.h>
 
 #ifdef ENABLE_NLS
 #include <gettext.h>
@@ -430,14 +431,14 @@ substitute (ELEMENT *tree, NAMED_STRING_ELEMENT_LIST 
*replaced_substrings)
 
 /* the caller should have made sure that the
    inserted elements do not appear elsewhere in the tree. */
-int
+size_t
 replace_convert_substrings (char *translated_string,
                             NAMED_STRING_ELEMENT_LIST *replaced_substrings,
                             int debug_level)
 {
   int i;
   char *texinfo_line;
-  int document_descriptor;
+  size_t document_descriptor;
   int parser_debug_level = 0;
   DOCUMENT *document;
 
@@ -527,17 +528,17 @@ replace_convert_substrings (char *translated_string,
 }
 
 /* returns a document descriptor. */
-int
+size_t
 gdt (const char *string, const char *lang,
      NAMED_STRING_ELEMENT_LIST *replaced_substrings,
      int debug_level, const char *translation_context)
 {
-  int document_descriptor;
+  size_t document_descriptor;
 
   char *translated_string = translate_string (string, lang,
                                               translation_context);
 
-  document_descriptor  = replace_convert_substrings (translated_string,
+  document_descriptor = replace_convert_substrings (translated_string,
                                   replaced_substrings, debug_level);
   free (translated_string);
   return document_descriptor;
@@ -552,8 +553,8 @@ gdt_tree (const char *string, DOCUMENT *document,
           const char *lang, NAMED_STRING_ELEMENT_LIST *replaced_substrings,
           int debug_level, const char *translation_context)
 {
-  int gdt_document_descriptor = gdt (string, lang, replaced_substrings,
-                                    debug_level, translation_context);
+  size_t gdt_document_descriptor = gdt (string, lang, replaced_substrings,
+                                        debug_level, translation_context);
   ELEMENT *tree
     = unregister_document_merge_with_document (gdt_document_descriptor,
                                                document);
diff --git a/tp/Texinfo/XS/main/translations.h 
b/tp/Texinfo/XS/main/translations.h
index 738862ae2d..0dc621326c 100644
--- a/tp/Texinfo/XS/main/translations.h
+++ b/tp/Texinfo/XS/main/translations.h
@@ -26,15 +26,15 @@ void configure_output_strings_translations (char 
*localesdir,
 
 char *translate_string (const char * string, const char *lang,
                         const char *translation_context);
-int replace_convert_substrings (char *translated_string,
-                            NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-                            int debug_level);
+size_t replace_convert_substrings (char *translated_string,
+                          NAMED_STRING_ELEMENT_LIST *replaced_substrings,
+                          int debug_level);
 char *replace_substrings (const char *string,
                     const NAMED_STRING_ELEMENT_LIST *replaced_substrings);
 
-int gdt (const char *string, const char *lang,
-         NAMED_STRING_ELEMENT_LIST *replaced_substrings,
-         int debug_level, const char *translation_context);
+size_t gdt (const char *string, const char *lang,
+            NAMED_STRING_ELEMENT_LIST *replaced_substrings,
+            int debug_level, const char *translation_context);
 
 ELEMENT *gdt_tree (const char *string, DOCUMENT *document,
                    const char *lang,
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.xs 
b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
index 682f55641a..ebd0dc46d5 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.xs
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.xs
@@ -15,6 +15,8 @@
 
 #include <config.h>
 
+#include <stddef.h>
+
 /* Avoid namespace conflicts. */
 #define context perl_context
 
@@ -75,12 +77,12 @@ register_parser_conf (SV *parser)
                 newSViv (parser_conf->descriptor), 0);
 
 # file path, can be in any encoding
-int
+size_t
 parse_file (SV *parser, input_file_path)
         char *input_file_path = (char *)SvPVbyte_nolen ($arg);
     PREINIT:
         int status;
-        int document_descriptor = 0;
+        size_t document_descriptor = 0;
       CODE:
         apply_sv_parser_conf (parser);
         document_descriptor = parse_file (input_file_path, &status);
@@ -97,7 +99,7 @@ parse_file (SV *parser, input_file_path)
       OUTPUT:
         RETVAL
 
-int
+size_t
 parse_piece (SV *parser, string, line_nr)
         char *string = (char *)SvPVutf8_nolen ($arg);
         int line_nr
@@ -107,7 +109,7 @@ parse_piece (SV *parser, string, line_nr)
       OUTPUT:
         RETVAL
 
-int
+size_t
 parse_string (SV *parser, string, line_nr)
         char *string = (char *)SvPVutf8_nolen ($arg);
         int line_nr
@@ -117,7 +119,7 @@ parse_string (SV *parser, string, line_nr)
       OUTPUT:
         RETVAL
 
-int
+size_t
 parse_text (SV *parser, string, line_nr)
         char *string = (char *)SvPVutf8_nolen ($arg);
         int line_nr
@@ -132,7 +134,7 @@ parse_text (SV *parser, string, line_nr)
 # would have been nice, but in that case an undef value cannot be passed
 # and leads to a perl warning
 SV *
-build_document (int document_descriptor, ...)
+build_document (size_t document_descriptor, ...)
       PROTOTYPE: $;$
       PREINIT:
         int no_store = 0;
@@ -145,10 +147,10 @@ build_document (int document_descriptor, ...)
         RETVAL
 
 SV *
-get_document (int document_descriptor)
+get_document (size_t document_descriptor)
 
 void
-pass_document_parser_errors_to_registrar (int document_descriptor, SV 
*parser_sv)
+pass_document_parser_errors_to_registrar (size_t document_descriptor, SV 
*parser_sv)
 
 void
 parser_store_values (SV *values)
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index aea15d4b67..c2a7a1051c 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -161,7 +161,7 @@ parse_file_path (const char *input_file_path, char **result)
    messages and destroy the document.
 
    Used for parse_texi_file. */
-int
+size_t
 parse_file (const char *input_file_path, int *status)
 {
   size_t document_descriptor = initialize_parsing (ct_base);
@@ -209,7 +209,7 @@ parse_file (const char *input_file_path, int *status)
 }
 
 /* Used for parse_texi_text.  STRING should be a UTF-8 buffer. */
-int
+size_t
 parse_text (const char *string, int line_nr)
 {
   size_t document_descriptor = initialize_parsing (ct_base);
@@ -222,7 +222,7 @@ parse_text (const char *string, int line_nr)
 /* Set DOCUMENT_DESCRIPTOR to the value corresponding to the tree
    obtained by parsing the Texinfo code in STRING.
    STRING should be a UTF-8 buffer.  Used for parse_texi_line. */
-int
+size_t
 parse_string (const char *string, int line_nr)
 {
   ELEMENT *root_elt;
@@ -236,7 +236,7 @@ parse_string (const char *string, int line_nr)
 }
 
 /* Used for parse_texi_piece.  STRING should be a UTF-8 buffer. */
-int
+size_t
 parse_piece (const char *string, int line_nr)
 {
   size_t document_descriptor = initialize_parsing (ct_base);
diff --git a/tp/Texinfo/XS/parsetexi/api.h b/tp/Texinfo/XS/parsetexi/api.h
index 7d1e834512..b96fd28959 100644
--- a/tp/Texinfo/XS/parsetexi/api.h
+++ b/tp/Texinfo/XS/parsetexi/api.h
@@ -4,10 +4,10 @@
 
 #include "tree_types.h"
 
-int parse_file (const char *input_file_path, int *status);
-int parse_piece (const char *, int line_nr);
-int parse_string (const char *, int line_nr);
-int parse_text (const char *, int line_nr);
+size_t parse_file (const char *input_file_path, int *status);
+size_t parse_piece (const char *, int line_nr);
+size_t parse_string (const char *, int line_nr);
+size_t parse_text (const char *, int line_nr);
 void reset_parser (int debug_output);
 
 void parser_conf_reset_values (void);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 2ea781b86d..b9eea3cc99 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -427,8 +427,9 @@ setup_document_root_and_before_node_section (void)
 
 /* Put everything before @setfilename in a special type and separate
    a preamble for informative commands */
-void
-rearrange_tree_beginning (ELEMENT *before_node_section, int 
document_descriptor)
+static void
+rearrange_tree_beginning (ELEMENT *before_node_section,
+                          size_t document_descriptor)
 {
   DOCUMENT *document = retrieve_document (document_descriptor);
   ELEMENT *informational_preamble;
@@ -502,10 +503,10 @@ rearrange_tree_beginning (ELEMENT *before_node_section, 
int document_descriptor)
 }
 
 
-int
+void
 parse_texi_document (void)
 {
-  int document_descriptor;
+  size_t document_descriptor;
   char *line = 0;
   const char *linep;
 
@@ -557,8 +558,6 @@ parse_texi_document (void)
    */
 
   rearrange_tree_beginning (before_node_section, document_descriptor);
-
-  return document_descriptor;
 }
 
 
@@ -2657,8 +2656,11 @@ check_line_directive (const char *line)
 }
 
 /* Pass in a ROOT_ELT root of "Texinfo tree".  Starting point for adding
-   to the tree is CURRENT_ELT.  Returns a stored DOCUMENT_DESCRIPTOR */
-int
+   to the tree is CURRENT_ELT.
+   Returns a stored DOCUMENT_DESCRIPTOR, though caller could also take it
+   directly from parsed_document.
+  */
+size_t
 parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
 {
   ELEMENT *current = current_elt;
diff --git a/tp/Texinfo/XS/parsetexi/parser.h b/tp/Texinfo/XS/parsetexi/parser.h
index ccb490f3aa..56603d4d10 100644
--- a/tp/Texinfo/XS/parsetexi/parser.h
+++ b/tp/Texinfo/XS/parsetexi/parser.h
@@ -65,8 +65,8 @@ typedef struct {
 } CONDITIONAL_STACK_ITEM;
 
 ELEMENT *setup_document_root_and_before_node_section (void);
-int parse_texi (ELEMENT *root_elt, ELEMENT *current_elt);
-int parse_texi_document (void);
+size_t parse_texi (ELEMENT *root_elt, ELEMENT *current_elt);
+void parse_texi_document (void);
 
 void push_conditional_stack (enum command_id cond, SOURCE_MARK *source_mark);
 CONDITIONAL_STACK_ITEM *pop_conditional_stack (void);



reply via email to

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