[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 13 Nov 2023 16:08:41 -0500 (EST) |
branch: master
commit f4f942938b86e25cb022e5cbe80a2aeebcd39d69
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 13 21:42:56 2023 +0100
* tp/Texinfo/XS/main/convert_to_texinfo.c
(convert_contents_to_texinfo, check_node_same_texinfo_code)
(root_heading_command_to_texinfo), tp/Texinfo/XS/main/debug.c
(print_associate_info_debug, print_element_debug_details),
tp/Texinfo/XS/main/tree.c (last_args_child): mark elements in argument
and in code as const when they are not modified.
---
ChangeLog | 9 +++++++++
tp/Texinfo/XS/main/convert_to_texinfo.c | 18 ++++++++++--------
tp/Texinfo/XS/main/convert_to_texinfo.h | 8 ++++----
tp/Texinfo/XS/main/debug.c | 8 ++++----
tp/Texinfo/XS/main/debug.h | 2 +-
tp/Texinfo/XS/main/tree.c | 2 +-
tp/Texinfo/XS/main/tree.h | 2 +-
7 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 96b92052c9..cef0918478 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,15 @@
* tp/Texinfo/XS:
Run "gnulib-tool --add-import uchar".
+2023-11-13 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/convert_to_texinfo.c
+ (convert_contents_to_texinfo, check_node_same_texinfo_code)
+ (root_heading_command_to_texinfo), tp/Texinfo/XS/main/debug.c
+ (print_associate_info_debug, print_element_debug_details),
+ tp/Texinfo/XS/main/tree.c (last_args_child): mark elements in argument
+ and in code as const when they are not modified.
+
2023-11-13 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/convert_to_text.c (brace_no_arg_command)
diff --git a/tp/Texinfo/XS/main/convert_to_texinfo.c
b/tp/Texinfo/XS/main/convert_to_texinfo.c
index b9492c71eb..fd0b6ff43b 100644
--- a/tp/Texinfo/XS/main/convert_to_texinfo.c
+++ b/tp/Texinfo/XS/main/convert_to_texinfo.c
@@ -205,7 +205,7 @@ convert_to_texinfo (const ELEMENT *e)
}
char *
-convert_contents_to_texinfo (ELEMENT *e)
+convert_contents_to_texinfo (const ELEMENT *e)
{
ELEMENT *tmp = new_element (ET_NONE);
char *result;
@@ -252,22 +252,24 @@ link_element_to_texi (const ELEMENT *element)
char *
target_element_to_texi_label (const ELEMENT *element)
{
- ELEMENT *label_element = get_label_element (element);
+ const ELEMENT *label_element = get_label_element (element);
return convert_contents_to_texinfo (label_element);
}
int
-check_node_same_texinfo_code (ELEMENT *reference_node, ELEMENT *node_content)
+check_node_same_texinfo_code (const ELEMENT *reference_node,
+ const ELEMENT *node_content)
{
char *reference_node_texi;
char *node_texi;
int equal_texi;
- KEY_PAIR *k_normalized = lookup_extra (reference_node, "normalized");
+ const KEY_PAIR *k_normalized
+ = lookup_extra (reference_node, "normalized");
if (k_normalized && k_normalized->value)
{
char *tmp_texi;
- ELEMENT *label_element = get_label_element (reference_node);
+ const ELEMENT *label_element = get_label_element (reference_node);
tmp_texi = convert_contents_to_texinfo (label_element);
reference_node_texi = collapse_spaces (tmp_texi);
@@ -280,7 +282,7 @@ check_node_same_texinfo_code (ELEMENT *reference_node,
ELEMENT *node_content)
{
char *tmp_texi;
- ELEMENT *last_content = last_contents_child (node_content);
+ const ELEMENT *last_content = last_contents_child (node_content);
if (last_content && last_content->type == ET_space_at_end_menu_node)
{
ELEMENT *tmp_elt = new_element (ET_NONE);
@@ -309,9 +311,9 @@ check_node_same_texinfo_code (ELEMENT *reference_node,
ELEMENT *node_content)
/* for debugging */
/* Return value to be freed by caller. */
char *
-root_heading_command_to_texinfo (ELEMENT *element)
+root_heading_command_to_texinfo (const ELEMENT *element)
{
- ELEMENT *tree = 0;
+ const ELEMENT *tree = 0;
TEXT text;
if (element->cmd)
diff --git a/tp/Texinfo/XS/main/convert_to_texinfo.h
b/tp/Texinfo/XS/main/convert_to_texinfo.h
index bd347c84c1..f33ff7190f 100644
--- a/tp/Texinfo/XS/main/convert_to_texinfo.h
+++ b/tp/Texinfo/XS/main/convert_to_texinfo.h
@@ -5,12 +5,12 @@
#include "tree_types.h"
char *convert_to_texinfo (const ELEMENT *e);
-char *convert_contents_to_texinfo (ELEMENT *e);
+char *convert_contents_to_texinfo (const ELEMENT *e);
char *link_element_to_texi (const ELEMENT *element);
char *target_element_to_texi_label (const ELEMENT *element);
-int check_node_same_texinfo_code(ELEMENT *reference_node,
- ELEMENT *node_content);
-char *root_heading_command_to_texinfo (ELEMENT *element);
+int check_node_same_texinfo_code(const ELEMENT *reference_node,
+ const ELEMENT *node_content);
+char *root_heading_command_to_texinfo (const ELEMENT *element);
#endif
diff --git a/tp/Texinfo/XS/main/debug.c b/tp/Texinfo/XS/main/debug.c
index 28edb24a97..7964333e8b 100644
--- a/tp/Texinfo/XS/main/debug.c
+++ b/tp/Texinfo/XS/main/debug.c
@@ -125,7 +125,7 @@ print_element_debug (const ELEMENT *e, int print_parent)
return result;
}
-char *print_associate_info_debug (ASSOCIATED_INFO *info)
+char *print_associate_info_debug (const ASSOCIATED_INFO *info)
{
TEXT text;
char *result;
@@ -137,7 +137,7 @@ char *print_associate_info_debug (ASSOCIATED_INFO *info)
for (i = 0; i < info->info_number; i++)
{
char *key = info->info[i].key;
- ELEMENT *f = (ELEMENT *) info->info[i].value;
+ const ELEMENT *f = (ELEMENT *) info->info[i].value;
text_printf (&text, " %s|", key);
switch (info->info[i].type)
{
@@ -180,7 +180,7 @@ char *print_associate_info_debug (ASSOCIATED_INFO *info)
text_append (&text, "contents: ");
for (j = 0; j < f->contents.number; j++)
{
- ELEMENT *e = f->contents.list[j];
+ const ELEMENT *e = f->contents.list[j];
char *element_str = print_element_debug (e, 0);
text_printf (&text, "%p;%s|", e, element_str);
free (element_str);
@@ -200,7 +200,7 @@ char *print_associate_info_debug (ASSOCIATED_INFO *info)
}
char *
-print_element_debug_details (ELEMENT *e, int print_parent)
+print_element_debug_details (const ELEMENT *e, int print_parent)
{
char *string = print_element_debug (e, print_parent);
TEXT text;
diff --git a/tp/Texinfo/XS/main/debug.h b/tp/Texinfo/XS/main/debug.h
index e18b41f302..56e45b8937 100644
--- a/tp/Texinfo/XS/main/debug.h
+++ b/tp/Texinfo/XS/main/debug.h
@@ -14,7 +14,7 @@ void debug_nonl (char *s, ...);
void set_debug_output (int value);
void debug_print_element (const ELEMENT *e, int print_parent);
char *print_element_debug (const ELEMENT *e, int print_parent);
-char *print_element_debug_details (ELEMENT *e, int print_parent);
+char *print_element_debug_details (const ELEMENT *e, int print_parent);
void debug_print_protected_string (char *input_string);
char *debug_protect_eol (char *input_string, int *allocated);
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index b94bb5ea1d..69c5f84404 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -480,7 +480,7 @@ last_args_child (ELEMENT *current)
}
ELEMENT *
-last_contents_child (ELEMENT *current)
+last_contents_child (const ELEMENT *current)
{
if (current->contents.number == 0)
return 0;
diff --git a/tp/Texinfo/XS/main/tree.h b/tp/Texinfo/XS/main/tree.h
index a9b6fc231f..85fac5c72d 100644
--- a/tp/Texinfo/XS/main/tree.h
+++ b/tp/Texinfo/XS/main/tree.h
@@ -31,7 +31,7 @@ ELEMENT *remove_from_contents (ELEMENT *parent, int where);
ELEMENT *remove_from_args (ELEMENT *parent, int where);
void remove_slice_from_contents (ELEMENT *parent, int start, int end);
ELEMENT *last_args_child (ELEMENT *current);
-ELEMENT *last_contents_child (ELEMENT *current);
+ELEMENT *last_contents_child (const ELEMENT *current);
ELEMENT *pop_element_from_args (ELEMENT *parent);
ELEMENT *pop_element_from_contents (ELEMENT *parent);
ELEMENT *contents_child_by_index (ELEMENT *e, int index);