[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 13 Nov 2023 16:08:42 -0500 (EST) |
branch: master
commit 9b4dae83b34a8b3a13a9cd35b1da29a79ec6b7ce
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 13 22:07:09 2023 +0100
* tp/Texinfo/XS/main/convert_to_text.c (text_accents, text_heading)
(convert_to_text_internal, convert_to_text): set element arguments and
elemnts to const if they are not modified, to make sure that the
Texinfo tree is not modified.
---
ChangeLog | 7 +++++++
tp/Texinfo/XS/main/convert_to_text.c | 20 ++++++++++----------
tp/Texinfo/XS/main/convert_to_text.h | 2 +-
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 668923ff42..5baee11589 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,13 @@
* tp/Texinfo/XS:
Run "gnulib-tool --add-import uchar".
+2023-11-13 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/convert_to_text.c (text_accents, text_heading)
+ (convert_to_text_internal, convert_to_text): set element arguments and
+ elemnts to const if they are not modified, to make sure that the
+ Texinfo tree is not modified.
+
2023-11-13 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/convert_to_text.c (ascii_accents_internal),
diff --git a/tp/Texinfo/XS/main/convert_to_text.c
b/tp/Texinfo/XS/main/convert_to_text.c
index d157fad0f0..6ac1c281af 100644
--- a/tp/Texinfo/XS/main/convert_to_text.c
+++ b/tp/Texinfo/XS/main/convert_to_text.c
@@ -175,7 +175,7 @@ copy_options_for_convert_text (CONVERTER *self,
/* format an accent command and nested accents within as Text. */
char *
-text_accents (ELEMENT *accent, char *encoding, int set_case)
+text_accents (const ELEMENT *accent, char *encoding, int set_case)
{
ACCENTS_STACK *accent_stack = find_innermost_accent_contents (accent);
char *text;
@@ -270,7 +270,7 @@ static const char *underline_symbol[5] = {"*", "*", "=",
"-", "."};
/* Return the text of an underlined heading, possibly indented. */
/* return to be freed by caller */
char *
-text_heading (const ELEMENT *current, char *text, OPTIONS *options,
+text_heading (const ELEMENT *current, const char *text, OPTIONS *options,
int numbered, int indent_length)
{
int i;
@@ -337,11 +337,11 @@ text_heading (const ELEMENT *current, char *text, OPTIONS
*options,
#define ADD(x) text_append (result, x)
void
-convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS *text_options,
+convert_to_text_internal (const ELEMENT *element, TEXT_OPTIONS *text_options,
TEXT *result);
void
-convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS *text_options,
+convert_to_text_internal (const ELEMENT *element, TEXT_OPTIONS *text_options,
TEXT *result)
{
enum command_id data_cmd = 0;
@@ -712,7 +712,7 @@ convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS
*text_options,
text_init (&args_line);
for (i = 0; i < element->args.number; i++)
{
- ELEMENT *arg = element->args.list[i];
+ const ELEMENT *arg = element->args.list[i];
TEXT converted_arg;
text_init (&converted_arg);
convert_to_text_internal (arg, text_options, &converted_arg);
@@ -776,7 +776,7 @@ convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS
*text_options,
}
else if (element->cmd == CM_sp)
{
- ELEMENT *misc_args = lookup_extra_element (element, "misc_args");
+ const ELEMENT *misc_args = lookup_extra_element (element,
"misc_args");
/* misc_args can be 0 with invalid args */
if (misc_args && misc_args->contents.number > 0)
{
@@ -835,8 +835,8 @@ convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS
*text_options,
{
PARSED_DEF *parsed_def = definition_arguments_content (element);
ELEMENT *parsed_definition_category
- = definition_category_tree(0, /* $options->{'converter'} */
- element);
+ = definition_category_tree (0, /* $options->{'converter'} */
+ element);
if (parsed_definition_category)
{
ELEMENT *converted_element = new_element (ET_NONE);
@@ -911,7 +911,7 @@ convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS
*text_options,
for (i = 0; i < element->contents.number; i++)
{
- ELEMENT *content = element->contents.list[i];
+ const ELEMENT *content = element->contents.list[i];
convert_to_text_internal (content,
text_options, result);
}
@@ -933,7 +933,7 @@ convert_to_text_internal (ELEMENT *element, TEXT_OPTIONS
*text_options,
/* Return value to be freed by caller. */
char *
-convert_to_text (ELEMENT *root, TEXT_OPTIONS *text_options)
+convert_to_text (const ELEMENT *root, TEXT_OPTIONS *text_options)
{
TEXT result;
diff --git a/tp/Texinfo/XS/main/convert_to_text.h
b/tp/Texinfo/XS/main/convert_to_text.h
index 2d7dd674d4..6d2ce74bf6 100644
--- a/tp/Texinfo/XS/main/convert_to_text.h
+++ b/tp/Texinfo/XS/main/convert_to_text.h
@@ -25,7 +25,7 @@ typedef struct TEXT_OPTIONS {
int document_descriptor;
} TEXT_OPTIONS;
-char *convert_to_text (ELEMENT *root, TEXT_OPTIONS *text_options);
+char *convert_to_text (const ELEMENT *root, TEXT_OPTIONS *text_options);
TEXT_OPTIONS *new_text_options (void);
void destroy_text_options (TEXT_OPTIONS *text_options);
TEXT_OPTIONS *copy_options_for_convert_text (CONVERTER *self,
- Prev by Date:
[no subject]
- Next by Date:
branch master updated: * tp/Texinfo/XS/convert/call_html_perl_function.c (call_file_id_setting_label_target_name) (call_file_id_setting_node_file_name) (call_file_id_setting_sectioning_command_target_name), tp/Texinfo/XS/convert/convert_html.c (find_element_target) (prepare_special_units, add_element_target_to_list) (add_element_target, add_special_target, normalized_label_id_file) (new_sectioning_command_target, set_root_commands_targets_node_files) (prepare_index_entries_targets, prepare_footnotes_targets) (ht [...]
- Previous by thread:
[no subject]
- Next by thread:
branch master updated: * tp/Texinfo/XS/convert/call_html_perl_function.c (call_file_id_setting_label_target_name) (call_file_id_setting_node_file_name) (call_file_id_setting_sectioning_command_target_name), tp/Texinfo/XS/convert/convert_html.c (find_element_target) (prepare_special_units, add_element_target_to_list) (add_element_target, add_special_target, normalized_label_id_file) (new_sectioning_command_target, set_root_commands_targets_node_files) (prepare_index_entries_targets, prepare_footnotes_targets) (ht [...]
- Index(es):