[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/input.c (input_push_tex
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/input.c (input_push_text): call strdup in input_push_text for the value_flag instead of having it called by the caller. Make value_flag const. |
Date: |
Sat, 24 Feb 2024 12:28:11 -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 c61b276f4a * tp/Texinfo/XS/parsetexi/input.c (input_push_text): call
strdup in input_push_text for the value_flag instead of having it called by the
caller. Make value_flag const.
c61b276f4a is described below
commit c61b276f4aa89215e356121346d00effed80a2a0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 24 18:27:47 2024 +0100
* tp/Texinfo/XS/parsetexi/input.c (input_push_text): call strdup in
input_push_text for the value_flag instead of having it called by the
caller. Make value_flag const.
* tp/Texinfo/XS/parsetexi/input.c (input_push_file): add const.
---
ChangeLog | 8 ++++++++
tp/Texinfo/XS/parsetexi/input.c | 13 ++++++++-----
tp/Texinfo/XS/parsetexi/input.h | 4 ++--
tp/Texinfo/XS/parsetexi/parser.c | 3 +--
4 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ffb5c17440..0773efa28c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,14 @@
Running with TEXINFO_XS_PARSER=0 was broken.
+2024-02-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/input.c (input_push_text): call strdup in
+ input_push_text for the value_flag instead of having it called by the
+ caller. Make value_flag const.
+
+ * tp/Texinfo/XS/parsetexi/input.c (input_push_file): add const.
+
2024-02-24 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/input.c (input_push_file): use save_string
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index c706ad01ec..705abf0be0 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -453,12 +453,14 @@ next_text (ELEMENT *current)
If already within a macro expansion, but not from a macro expansion
(from a value expansion, for instance), the macro name will be taken
from the input stack.
- VALUE_FLAG is the name of the value flag expanded as text.
- VALUE_FLAG will be later free'd, but not MACRO_NAME.
+ VALUE_FLAG is the name of the value flag expanded as text. It is
+ copied, and the copy will be later free'd, but the argument is never
+ free'd. MACRO_NAME is copied and the copy is saved using save_string,
+ the argument is not free'd.
*/
void
input_push_text (char *text, int line_number, const char *macro_name,
- char *value_flag)
+ const char *value_flag)
{
char *filename = 0;
const char *in_macro = 0;
@@ -496,7 +498,8 @@ input_push_text (char *text, int line_number, const char
*macro_name,
input_stack[input_number].source_info.file_name = save_string (filename);
input_stack[input_number].source_info.macro = save_string (in_macro);
input_stack[input_number].macro_name = save_string (macro_name);
- input_stack[input_number].value_flag = value_flag;
+ input_stack[input_number].value_flag
+ = value_flag ? strdup (value_flag) : 0;
input_stack[input_number].input_source_mark = 0;
input_number++;
}
@@ -618,7 +621,7 @@ parser_locate_include_file (const char *filename)
/* Try to open a file called FILENAME */
int
-input_push_file (char *filename)
+input_push_file (const char *filename)
{
FILE *stream = 0;
char *p, *q;
diff --git a/tp/Texinfo/XS/parsetexi/input.h b/tp/Texinfo/XS/parsetexi/input.h
index 8ecfb708e8..58583d4302 100644
--- a/tp/Texinfo/XS/parsetexi/input.h
+++ b/tp/Texinfo/XS/parsetexi/input.h
@@ -12,8 +12,8 @@ char *next_text (ELEMENT *current);
void save_line_directive (int line_nr, char *filename);
void input_push_text (char *text, int line_number, const char *macro_name,
- char *value_flag);
-int input_push_file (char *filename);
+ const char *value_flag);
+int input_push_file (const char *filename);
void input_pushback (char *line);
void set_input_source_mark (SOURCE_MARK *source_mark);
void input_reset_input_stack (void);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 7a7e7db351..5d22df810c 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1859,8 +1859,7 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
input_push_text (strdup (remaining_line),
current_source_info.line_nr, 0, 0);
input_push_text (strdup (value),
- current_source_info.line_nr, 0,
- strdup (flag));
+ current_source_info.line_nr, 0, flag);
value_source_mark
= new_source_mark (SM_type_value_expansion);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/input.c (input_push_text): call strdup in input_push_text for the value_flag instead of having it called by the caller. Make value_flag const.,
Patrice Dumas <=