[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/tree.c (new_list, destroy_li
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/tree.c (new_list, destroy_list), tp/Texinfo/XS/structuring_transfo/transformations.c (modify_tree) (protect_text, protect_hashchar_at_line_beginning_internal) (reference_to_arg_internal): add new_list and destroy_list, use those functions. |
Date: |
Sun, 12 Nov 2023 10:22:42 -0500 |
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 e803120b77 * tp/Texinfo/XS/main/tree.c (new_list, destroy_list),
tp/Texinfo/XS/structuring_transfo/transformations.c (modify_tree)
(protect_text, protect_hashchar_at_line_beginning_internal)
(reference_to_arg_internal): add new_list and destroy_list, use those functions.
e803120b77 is described below
commit e803120b77d5004a88a3d8e12195fdaa9591fc22
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 12 16:22:36 2023 +0100
* tp/Texinfo/XS/main/tree.c (new_list, destroy_list),
tp/Texinfo/XS/structuring_transfo/transformations.c (modify_tree)
(protect_text, protect_hashchar_at_line_beginning_internal)
(reference_to_arg_internal): add new_list and destroy_list, use those
functions.
---
ChangeLog | 8 ++++++++
tp/Texinfo/XS/main/tree.c | 15 +++++++++++++++
tp/Texinfo/XS/main/tree.h | 2 ++
.../XS/structuring_transfo/transformations.c | 22 +++++++---------------
4 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c65efc93a5..9a832aa374 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/tree.c (new_list, destroy_list),
+ tp/Texinfo/XS/structuring_transfo/transformations.c (modify_tree)
+ (protect_text, protect_hashchar_at_line_beginning_internal)
+ (reference_to_arg_internal): add new_list and destroy_list, use those
+ functions.
+
2023-11-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/tree.c (insert_list_slice_into_list)
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index 036eb366a2..41c8e8c854 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -117,6 +117,21 @@ new_element (enum element_type type)
return e;
}
+ELEMENT_LIST *
+new_list ()
+{
+ ELEMENT_LIST *list = (ELEMENT_LIST *) malloc (sizeof (ELEMENT_LIST));
+ memset (list, 0, sizeof (ELEMENT_LIST));
+ return list;
+}
+
+void
+destroy_list (ELEMENT_LIST * list)
+{
+ free (list->list);
+ free (list);
+}
+
void
destroy_associated_info (ASSOCIATED_INFO *a)
{
diff --git a/tp/Texinfo/XS/main/tree.h b/tp/Texinfo/XS/main/tree.h
index 66efbdaba5..ea4f6710a3 100644
--- a/tp/Texinfo/XS/main/tree.h
+++ b/tp/Texinfo/XS/main/tree.h
@@ -8,6 +8,7 @@ void reset_obstacks (void);
ASSOCIATED_INFO *new_associated_info (void);
ELEMENT *new_element (enum element_type type);
+ELEMENT_LIST *new_list (void);
void add_to_element_list (ELEMENT_LIST *list, ELEMENT *e);
void add_to_element_contents (ELEMENT *parent, ELEMENT *e);
void add_to_contents_as_array (ELEMENT *parent, ELEMENT *e);
@@ -33,6 +34,7 @@ ELEMENT *pop_element_from_args (ELEMENT *parent);
ELEMENT *pop_element_from_contents (ELEMENT *parent);
ELEMENT *contents_child_by_index (ELEMENT *e, int index);
ELEMENT *args_child_by_index (ELEMENT *e, int index);
+void destroy_list (ELEMENT_LIST * list);
void destroy_element (ELEMENT *e);
void destroy_element_and_children (ELEMENT *e);
int replace_element_in_contents (ELEMENT *parent, ELEMENT *removed,
diff --git a/tp/Texinfo/XS/structuring_transfo/transformations.c
b/tp/Texinfo/XS/structuring_transfo/transformations.c
index 2459ff8537..6829fb31f7 100644
--- a/tp/Texinfo/XS/structuring_transfo/transformations.c
+++ b/tp/Texinfo/XS/structuring_transfo/transformations.c
@@ -189,8 +189,7 @@ modify_tree (ELEMENT *tree,
new_args, 0,
new_args->number);
i += new_args->number -1;
- free (new_args->list);
- free (new_args);
+ destroy_list (new_args);
}
else
modify_tree (tree->args.list[i], operation, argument);
@@ -212,8 +211,7 @@ modify_tree (ELEMENT *tree,
new_contents, 0,
new_contents->number);
i += new_contents->number -1;
- free (new_contents->list);
- free (new_contents);
+ destroy_list (new_contents);
}
else
modify_tree (tree->contents.list[i], operation, argument);
@@ -236,8 +234,7 @@ modify_tree (ELEMENT *tree,
do it? */
tree->source_mark_list.list[i]->element
= new_element->list[0];
- free (new_element->list);
- free (new_element);
+ destroy_list (new_element);
}
}
}
@@ -899,8 +896,7 @@ reference_to_arg_internal (const char *type,
int *arguments_order = ref_5_args_order;
/* container for the new elements to insert, will be destroyed
by the caller */
- ELEMENT_LIST *container = (ELEMENT_LIST *) malloc (sizeof
(ELEMENT_LIST));
- memset (container, 0, sizeof (ELEMENT_LIST));
+ ELEMENT_LIST *container = new_list ();
ELEMENT *new = new_element (ET_NONE);
new->parent = e->parent;
add_to_element_list (container, new);
@@ -1109,7 +1105,7 @@ complete_node_menu (ELEMENT *node, int use_sections)
destroy_element (node_childs);
}
-ELEMENT *
+static ELEMENT *
get_non_automatic_nodes_with_sections (ELEMENT *root)
{
ELEMENT *non_automatic_nodes = new_element (ET_NONE);
@@ -1310,9 +1306,7 @@ protect_text (ELEMENT *current, char *to_protect)
|| current->type == ET_rawline_arg)
&& strpbrk (current->text.text, to_protect))
{
- ELEMENT_LIST *container
- = (ELEMENT_LIST *) malloc (sizeof (ELEMENT_LIST));
- memset (container, 0, sizeof (ELEMENT_LIST));
+ ELEMENT_LIST *container = new_list();
char *p = current->text.text;
/* count UTF-8 encoded Unicode characters for source marks locations */
size_t current_position = 0;
@@ -1520,9 +1514,7 @@ protect_hashchar_at_line_beginning_internal (const char
*type,
}
else
{
- ELEMENT_LIST *container = (ELEMENT_LIST *)
- malloc (sizeof (ELEMENT_LIST));
- memset (container, 0, sizeof (ELEMENT_LIST));
+ ELEMENT_LIST *container = new_list ();
char *current_text = strdup (current->text.text);
char *p = current_text;
int leading_spaces_nr;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/tree.c (new_list, destroy_list), tp/Texinfo/XS/structuring_transfo/transformations.c (modify_tree) (protect_text, protect_hashchar_at_line_beginning_internal) (reference_to_arg_internal): add new_list and destroy_list, use those functions.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/XS/main/tree.c (insert_list_slice_into_list) (insert_slice_into_contents, insert_list_slice_into_args) (insert_list_slice_into_contents): add insert_list_slice_into_list, use it in other functions, add insert_list_slice_into_args and insert_list_slice_into_contents. Remove insert_contents_slice_into_args.
- Next by Date:
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units) (set_root_commands_targets_node_files), tp/Texinfo/XS/main/build_perl_info.c (build_elements_list) (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT), tp/Texinfo/XS/main/document.c (register_document_nodes_list) (register_document_sections_list) (destroy_document_information_except_tree), tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (sectioning_structure, nodes_tree), tp/Texinfo/XS/structuring_transfo/ [...]
- Previous by thread:
branch master updated: * tp/Texinfo/XS/main/tree.c (insert_list_slice_into_list) (insert_slice_into_contents, insert_list_slice_into_args) (insert_list_slice_into_contents): add insert_list_slice_into_list, use it in other functions, add insert_list_slice_into_args and insert_list_slice_into_contents. Remove insert_contents_slice_into_args.
- Next by thread:
branch master updated: * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units) (set_root_commands_targets_node_files), tp/Texinfo/XS/main/build_perl_info.c (build_elements_list) (build_document), tp/Texinfo/XS/main/converter_types.h (DOCUMENT), tp/Texinfo/XS/main/document.c (register_document_nodes_list) (register_document_sections_list) (destroy_document_information_except_tree), tp/Texinfo/XS/structuring_transfo/StructuringTransfo.xs (sectioning_structure, nodes_tree), tp/Texinfo/XS/structuring_transfo/ [...]
- Index(es):