[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/close.c (remove_empty_c
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/close.c (remove_empty_content) (close_container, close_commands), tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line, end_line_starting_block, end_line), tp/Texinfo/XS/parsetexi/parser.c (merge_text, abort_empty_line) (isolate_last_space), tp/Texinfo/XS/parsetexi/source_marks.c (place_source_mark): do not use print_element_debug without free'ing the result string, instead use debug_print_element more to avoid memory leaks. Report and idea of fix from Gavin. |
Date: |
Tue, 11 Jul 2023 19:37:46 -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 b583e2ead8 * tp/Texinfo/XS/parsetexi/close.c (remove_empty_content)
(close_container, close_commands), tp/Texinfo/XS/parsetexi/end_line.c
(end_line_def_line, end_line_starting_block, end_line),
tp/Texinfo/XS/parsetexi/parser.c (merge_text, abort_empty_line)
(isolate_last_space), tp/Texinfo/XS/parsetexi/source_marks.c
(place_source_mark): do not use print_element_debug without free'ing the result
string, instead use debug_print_element more to avoid memory leaks. Report and
idea [...]
b583e2ead8 is described below
commit b583e2ead8703806a7e365f0b6ae0a20b0e9d1c2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Jul 12 01:37:35 2023 +0200
* tp/Texinfo/XS/parsetexi/close.c (remove_empty_content)
(close_container, close_commands), tp/Texinfo/XS/parsetexi/end_line.c
(end_line_def_line, end_line_starting_block, end_line),
tp/Texinfo/XS/parsetexi/parser.c (merge_text, abort_empty_line)
(isolate_last_space), tp/Texinfo/XS/parsetexi/source_marks.c
(place_source_mark): do not use print_element_debug without free'ing
the result string, instead use debug_print_element more to avoid
memory leaks. Report and idea of fix from Gavin.
---
ChangeLog | 11 ++++++++++
tp/Texinfo/XS/parsetexi/close.c | 21 ++++++++++---------
tp/Texinfo/XS/parsetexi/end_line.c | 11 ++++++----
tp/Texinfo/XS/parsetexi/parser.c | 37 +++++++++++++++++++++++-----------
tp/Texinfo/XS/parsetexi/source_marks.c | 9 +++++----
5 files changed, 59 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 85644410e8..776992ab36 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2023-07-10 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/close.c (remove_empty_content)
+ (close_container, close_commands), tp/Texinfo/XS/parsetexi/end_line.c
+ (end_line_def_line, end_line_starting_block, end_line),
+ tp/Texinfo/XS/parsetexi/parser.c (merge_text, abort_empty_line)
+ (isolate_last_space), tp/Texinfo/XS/parsetexi/source_marks.c
+ (place_source_mark): do not use print_element_debug without free'ing
+ the result string, instead use debug_print_element more to avoid
+ memory leaks. Report and idea of fix from Gavin.
+
2023-07-11 Gavin Smith <gavinsmith0123@gmail.com>
NEWS: Mention CHECK_NORMAL_MENU_STRUCTURE change.
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index a900397e96..78735ea5ec 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -124,9 +124,9 @@ remove_empty_content (ELEMENT *current)
{
transfer_source_marks (child_element, current);
- debug ("REMOVE empty child %s from %s",
- print_element_debug(child_element, 0),
- print_element_debug(current, 0));
+ debug_nonl ("REMOVE empty child ");
+ debug_print_element (child_element, 0); debug_nonl (" from ");
+ debug_print_element (current, 0); debug ("");
destroy_element (pop_element_from_contents (current));
}
}
@@ -144,9 +144,10 @@ close_container (ELEMENT *current)
/* remove element without contents nor associated information */
if (is_container_empty (current))
{
- debug ("CONTAINER EMPTY %s (%d source marks)",
- print_element_debug(current, 1),
- current->source_mark_list.number);
+ debug_nonl ("CONTAINER EMPTY ");
+ debug_print_element (current, 1);
+ debug_nonl (" %d source marks)",
+ current->source_mark_list.number); debug ("");
if (current->source_mark_list.number > 0)
{
/* Keep the element to keep the source mark, but remove some types.
@@ -168,8 +169,8 @@ close_container (ELEMENT *current)
a manual */
if (last_child == element_to_remove)
{
- debug ("REMOVE empty type %s",
- print_element_debug(last_child, 1));
+ debug_nonl ("REMOVE empty type ");
+ debug_print_element (last_child, 1); debug ("");
destroy_element (pop_element_from_contents (current));
}
}
@@ -515,8 +516,8 @@ close_commands (ELEMENT *current, enum command_id
closed_block_command,
if (! ((current->cmd && command_flags(current) & CF_root)
|| (current->type == ET_before_node_section)))
{
- debug ("close_commands unexpectedly stopped %s",
- print_element_debug (current, 1));
+ debug_nonl ("close_commands unexpectedly stopped ");
+ debug_print_element (current, 1); debug ("");
}
}
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 137fba9790..4c6786387a 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -665,10 +665,11 @@ end_line_def_line (ELEMENT *current)
def_command = top_cmd;
}
- debug ("END DEF LINE %s %s; current %s",
+ debug_nonl ("END DEF LINE %s %s; current ",
top_context == ct_def ? "ct_def"
: top_context == ct_linecommand ? "ct_linecommand" : "",
- command_name(def_command), print_element_debug (current, 1));
+ command_name(def_command));
+ debug_print_element (current, 1); debug ("");
def_info = parse_def (def_command, current);
@@ -904,7 +905,8 @@ end_line_starting_block (ELEMENT *current)
if (pop_context () != ct_line)
fatal ("line context expected");
- debug ("END BLOCK LINE: %s", print_element_debug (current, 1));
+ debug_nonl ("END BLOCK LINE: ");
+ debug_print_element (current, 1); debug ("");
/* @multitable args */
if (command == CM_multitable
@@ -1912,7 +1914,8 @@ end_line (ELEMENT *current)
if (last_contents_child (current)
&& last_contents_child (current)->type == ET_empty_line)
{
- debug ("END EMPTY LINE in %s", print_element_debug (current, 0));
+ debug_nonl ("END EMPTY LINE in ");
+ debug_print_element (current, 0); debug ("");
if (current->type == ET_paragraph)
{
ELEMENT *e;
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 1a7b1bb5b4..517064be0d 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -700,10 +700,13 @@ merge_text (ELEMENT *current, char *text, ELEMENT
*transfer_marks_element)
}
transfer_marks_element->source_mark_list.number = 0;
}
+
+ debug_nonl ("MERGED TEXT: %s||| in ", text);
+ debug_print_element (last_child, 0);
+ debug_nonl (" last of ");
+ debug_print_element (current, 0); debug ("");
+
/* Append text */
- debug ("MERGED TEXT: %s||| in %s last of %s", text,
- print_element_debug (last_child, 0),
- print_element_debug (current, 0));
text_append (&last_child->text, text);
}
else
@@ -741,13 +744,14 @@ abort_empty_line (ELEMENT **current_inout, char
*additional_spaces)
{
retval = 1;
- debug ("ABORT EMPTY in %s(p:%d): %s; add |%s| "
- "to |%s|",
- print_element_debug (current, 0),
+ debug_nonl ("ABORT EMPTY in ");
+ debug_print_element (current, 0);
+ debug_nonl ("(p:%d): %s; add |%s| to |%s|",
in_paragraph_context (current_context ()),
element_type_name (last_child),
additional_spaces,
- last_child->text.text);
+ last_child->text.text); debug ("");
+
text_append (&last_child->text, additional_spaces);
/* Remove element altogether if it's empty. */
@@ -897,6 +901,7 @@ void
isolate_last_space (ELEMENT *current)
{
char *text;
+ char *debug_last_elt_str = "";
ELEMENT *last_elt;
int text_len;
@@ -929,19 +934,27 @@ isolate_last_space (ELEMENT *current)
if (!strchr (whitespace_chars, text[text_len - 1]))
goto no_isolate_space;
+ debug_nonl ("ISOLATE SPACE p ");
+ debug_print_element (current, 0);
+ debug_nonl ("; c ");
+ debug_print_element (last_elt, 0); debug ("");
+
if (current->type == ET_menu_entry_node)
isolate_trailing_space (current, ET_space_at_end_menu_node);
else
isolate_last_space_internal (current);
- debug ("ISOLATE SPACE p %s; c %s", print_element_debug (current, 0),
- current->contents.number == 0 ? "" : print_element_debug (last_elt, 0));
-
return;
no_isolate_space:
- debug ("NOT ISOLATING p %s; c %s", print_element_debug (current, 0),
- current->contents.number == 0 ? "" : print_element_debug (last_elt, 0));
+ debug_nonl ("NOT ISOLATING p ");
+ debug_print_element (current, 0);
+ if (current->contents.number != 0)
+ debug_last_elt_str = print_element_debug (last_elt, 0);
+ debug_nonl ("; c %s", debug_last_elt_str); debug ("");
+ if (current->contents.number != 0)
+ free (debug_last_elt_str);
+
return;
}
diff --git a/tp/Texinfo/XS/parsetexi/source_marks.c
b/tp/Texinfo/XS/parsetexi/source_marks.c
index e603924a03..b7d6480c2a 100644
--- a/tp/Texinfo/XS/parsetexi/source_marks.c
+++ b/tp/Texinfo/XS/parsetexi/source_marks.c
@@ -108,13 +108,14 @@ place_source_mark (ELEMENT *e, SOURCE_MARK *source_mark)
add_element_string = "add";
}
- debug ("MARK %s c: %d p: %d %s %s %s %s",
source_mark_name(source_mark->type),
+ debug_nonl ("MARK %s c: %d p: %d %s %s ",
source_mark_name(source_mark->type),
source_mark->counter, source_mark->position,
source_mark->status == SM_status_start ? "start"
: source_mark->status == SM_status_end ? "end"
- : "SM_status UNKNOWN", add_element_string,
- print_element_debug(mark_element, 0),
- print_element_debug(e, 0));
+ : "SM_status UNKNOWN", add_element_string);
+ debug_print_element(mark_element, 0); debug_nonl (" ");
+ debug_print_element(e, 0); debug ("");
+
add_source_mark (source_mark, mark_element);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/close.c (remove_empty_content) (close_container, close_commands), tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line, end_line_starting_block, end_line), tp/Texinfo/XS/parsetexi/parser.c (merge_text, abort_empty_line) (isolate_last_space), tp/Texinfo/XS/parsetexi/source_marks.c (place_source_mark): do not use print_element_debug without free'ing the result string, instead use debug_print_element more to avoid memory leaks. Report and idea of fix from Gavin.,
Patrice Dumas <=