[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (end_line_mi
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): free fullpath only after error messages have been output. |
Date: |
Sat, 12 Aug 2023 12:04:26 -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 d3a9b7fa10 * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line):
free fullpath only after error messages have been output.
d3a9b7fa10 is described below
commit d3a9b7fa107c8a1f391605acc7de4500b075d434
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 12 18:03:30 2023 +0200
* tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): free
fullpath only after error messages have been output.
* tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting, parse_texi):
add parentheses to avoid ambiguity and match better perl parser code.
(isolate_last_space): simplify debug output code.
* tp/Texinfo/XS/parsetexi/parser.c, tp/Texinfo/XS/parsetexi/input.c,
tp/Texinfo/XS/parsetexi/tree.c, tp/Texinfo/XS/parsetexi/close.c,
tp/Texinfo/XS/parsetexi/end_line.c, tp/Texinfo/XS/parsetexi/macro.c,
tp/Texinfo/XS/parsetexi/menus.c, tp/Texinfo/XS/parsetexi/indices.c:
remove unused variables.
* tp/Texinfo/XS/parsetexi/close.c (close_command_cleanup),
tp/Texinfo/XS/parsetexi/separator.c (handle_close_brace):
add parentheses to avoid ambiguity and match better perl parser code.
* tp/Texinfo/XS/parsetexi/api.c (store_source_mark_list): explicit
default in switch for SM_status_none.
* tp/Texinfo/XS/MiscXS.xs (xs_parse_texi_regex): remove left over
variable.
* tp/Texinfo/XS/xspara.c (xspara_init): group expresions to avoid
ambiguity.
* tp/Texinfo/XS/xspara.c (xspara_get_state): avoid mixing declarations
and code.
---
ChangeLog | 31 +++++++++++++++++++++++++++++++
tp/Texinfo/XS/MiscXS.xs | 1 -
tp/Texinfo/XS/parsetexi/api.c | 8 ++++++++
tp/Texinfo/XS/parsetexi/close.c | 11 +++++------
tp/Texinfo/XS/parsetexi/end_line.c | 8 +++-----
tp/Texinfo/XS/parsetexi/indices.c | 5 ++---
tp/Texinfo/XS/parsetexi/input.c | 1 -
tp/Texinfo/XS/parsetexi/macro.c | 2 --
tp/Texinfo/XS/parsetexi/menus.c | 2 --
tp/Texinfo/XS/parsetexi/parser.c | 31 +++++++++++++------------------
tp/Texinfo/XS/parsetexi/separator.c | 16 ++++++++--------
tp/Texinfo/XS/parsetexi/tree.c | 1 -
tp/Texinfo/XS/xspara.c | 12 ++++++------
13 files changed, 76 insertions(+), 53 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e0faeb4426..fe172ce7cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,37 @@
* NEWS: list updated automake version used for distribution
+2023-08-12 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): free
+ fullpath only after error messages have been output.
+
+ * tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting, parse_texi):
+ add parentheses to avoid ambiguity and match better perl parser code.
+ (isolate_last_space): simplify debug output code.
+
+ * tp/Texinfo/XS/parsetexi/parser.c, tp/Texinfo/XS/parsetexi/input.c,
+ tp/Texinfo/XS/parsetexi/tree.c, tp/Texinfo/XS/parsetexi/close.c,
+ tp/Texinfo/XS/parsetexi/end_line.c, tp/Texinfo/XS/parsetexi/macro.c,
+ tp/Texinfo/XS/parsetexi/menus.c, tp/Texinfo/XS/parsetexi/indices.c:
+ remove unused variables.
+
+ * tp/Texinfo/XS/parsetexi/close.c (close_command_cleanup),
+ tp/Texinfo/XS/parsetexi/separator.c (handle_close_brace):
+ add parentheses to avoid ambiguity and match better perl parser code.
+
+ * tp/Texinfo/XS/parsetexi/api.c (store_source_mark_list): explicit
+ default in switch for SM_status_none.
+
+ * tp/Texinfo/XS/MiscXS.xs (xs_parse_texi_regex): remove left over
+ variable.
+
+ * tp/Texinfo/XS/xspara.c (xspara_init): group expresions to avoid
+ ambiguity.
+
+ * tp/Texinfo/XS/xspara.c (xspara_get_state): avoid mixing declarations
+ and code.
+
2023-08-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/source_marks.c (source_marks_names): setup
diff --git a/tp/Texinfo/XS/MiscXS.xs b/tp/Texinfo/XS/MiscXS.xs
index bac8317c35..27d55b5397 100644
--- a/tp/Texinfo/XS/MiscXS.xs
+++ b/tp/Texinfo/XS/MiscXS.xs
@@ -128,7 +128,6 @@ xs_parse_texi_regex (text)
char *close_brace;
char *comma;
char *asterisk;
- char *separator_match;
char *form_feed;
char *menu_only_separator;
char *new_text;
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 36e8f7a462..b8720e6b38 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -494,6 +494,10 @@ store_source_mark_list (ELEMENT *e)
{
SAVE_S_M_STATUS (start)
SAVE_S_M_STATUS (end)
+
+ /* for SM_status_none */
+ default:
+ break;
}
#define SAVE_S_M_TYPE(X) \
@@ -513,6 +517,10 @@ store_source_mark_list (ELEMENT *e)
SAVE_S_M_TYPE (value_expansion)
SAVE_S_M_TYPE (ignored_conditional_block)
SAVE_S_M_TYPE (expanded_conditional_command)
+
+ /* for SM_type_none */
+ default:
+ break;
}
av_push (av, newRV_noinc ((SV *)source_mark));
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index 5c150fee1b..e7c8aa223e 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -319,11 +319,11 @@ close_command_cleanup (ELEMENT *current)
ELEMENT *e = current->contents.list[i];
if (e == before_item)
continue;
- if (e->cmd != CM_NONE
- && (e->cmd != CM_c && e->cmd != CM_comment
- && e->cmd != CM_end)
- || e->type != ET_NONE
- && e->type != ET_ignorable_spaces_after_command)
+ if ((e->cmd != CM_NONE
+ && (e->cmd != CM_c && e->cmd != CM_comment
+ && e->cmd != CM_end))
+ || (e->type != ET_NONE
+ && e->type != ET_ignorable_spaces_after_command))
{
empty_format = 0;
break;
@@ -426,7 +426,6 @@ close_current (ELEMENT *current,
}
else if (current->type != ET_NONE)
{
- enum context c;
ELEMENT *close_brace;
debug ("CLOSING type %s", element_type_name (current));
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index b0b2851b96..b96e1857e2 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -654,7 +654,6 @@ end_line_def_line (ELEMENT *current)
ELEMENT *def_info_class = 0;
ELEMENT *def_info_category = 0;
int i = 0;
- enum command_id top_cmd = current_context_command ();
enum context top_context = pop_context ();
if (top_context != ct_def)
@@ -888,8 +887,8 @@ end_line_starting_block (ELEMENT *current)
g = current->args.list[0]->contents.list[0];
/* Check if @enumerate specification is either a single
letter or a string of digits. */
- if (g->text.end == 1
- && isascii_alpha (g->text.text[0])
+ if ((g->text.end == 1
+ && isascii_alpha (g->text.text[0]))
|| (g->text.end > 0
&& !*(g->text.text
+ strspn (g->text.text, digit_chars))))
@@ -1291,7 +1290,6 @@ end_line_misc_line (ELEMENT *current)
else
{
status = input_push_file (fullpath);
- free (fullpath);
if (status)
{
char *decoded_file_path
@@ -1311,6 +1309,7 @@ end_line_misc_line (ELEMENT *current)
include_source_mark->status = SM_status_start;
set_input_source_mark (include_source_mark);
}
+ free (fullpath);
}
}
else if (current->cmd == CM_verbatiminclude)
@@ -1516,7 +1515,6 @@ end_line_misc_line (ELEMENT *current)
else if (current->cmd == CM_node)
{
int i;
- NODE_SPEC_EXTRA *node_label_manual_info;
for (i = 1; i < current->args.number && i < 4; i++)
{
diff --git a/tp/Texinfo/XS/parsetexi/indices.c
b/tp/Texinfo/XS/parsetexi/indices.c
index 9e9eeef3ab..706ae30616 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -265,7 +265,6 @@ enter_index_entry (enum command_id index_type_cmd,
{
INDEX *idx;
INDEX_ENTRY *entry;
- KEY_PAIR *k;
TEXT ignored_chars;
idx = index_of_command (index_type_cmd);
@@ -301,8 +300,8 @@ enter_index_entry (enum command_id index_type_cmd,
free (ignored_chars.text);
}
- /* index_entry is an array with two elements. Use an element with
extra_misc_args
- to pass that information as an array */
+ /* index_entry is an array with two elements. Use
+ extra_misc_args to pass that information as an array */
{
ELEMENT *index_entry = new_element (ET_NONE);
ELEMENT *e = new_element (ET_NONE);
diff --git a/tp/Texinfo/XS/parsetexi/input.c b/tp/Texinfo/XS/parsetexi/input.c
index bb1d9e7697..b189692eb9 100644
--- a/tp/Texinfo/XS/parsetexi/input.c
+++ b/tp/Texinfo/XS/parsetexi/input.c
@@ -260,7 +260,6 @@ encode_with_iconv (iconv_t our_iconv, char *s)
char *
convert_to_utf8 (char *s)
{
- iconv_t our_iconv = (iconv_t) -1;
char *ret;
/* Convert from @documentencoding to UTF-8.
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 4765e104a3..44596cbd18 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -60,7 +60,6 @@ new_macro (char *name, ELEMENT *macro)
enum command_id new;
MACRO *m = 0;
size_t free_slot = 0;
- ELEMENT *tmp;
/* Check for an existing definition first for us to overwrite. */
new = lookup_command (name);
@@ -539,7 +538,6 @@ expand_linemacro_arguments (ELEMENT *macro, char
**line_inout,
{
int single_char;
char *command;
- enum command_id cmd;
int whitespaces_len;
case '@':
pline = sep + 1;
diff --git a/tp/Texinfo/XS/parsetexi/menus.c b/tp/Texinfo/XS/parsetexi/menus.c
index f41a43848f..754fdcb328 100644
--- a/tp/Texinfo/XS/parsetexi/menus.c
+++ b/tp/Texinfo/XS/parsetexi/menus.c
@@ -147,8 +147,6 @@ handle_menu_entry_separators (ELEMENT **current_inout, char
**line_inout)
if (current->type == ET_preformatted
&& current->parent->type == ET_menu_comment)
{
- ELEMENT *menu = current->parent->parent;
-
/* Close ET_preformatted, and ET_menu_comment. */
current = close_container (current);
current = close_container (current);
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index a94de6f1b7..0fd50709db 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -942,7 +942,6 @@ void
isolate_last_space (ELEMENT *current)
{
char *text;
- char *debug_last_elt_str = "";
ELEMENT *last_elt;
int text_len;
@@ -987,14 +986,13 @@ isolate_last_space (ELEMENT *current)
return;
-no_isolate_space:
+ no_isolate_space:
debug_nonl ("NOT ISOLATING p ");
debug_print_element (current, 0);
+ debug_nonl ("; c ");
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);
+ debug_print_element (last_elt, 0);
+ debug ("");
return;
}
@@ -1181,10 +1179,10 @@ check_valid_nesting (ELEMENT *current, enum command_id
cmd)
if (cmd == CM_c || cmd == CM_comment)
ok = 1;
}
- else if ((outer_flags & CF_brace) /* "full text commands" */
+ else if (((outer_flags & CF_brace) /* "full text commands" */
&& (command_data(outer).data == BRACE_style_other
- || command_data(outer).data == BRACE_style_code
- || command_data(outer).data == BRACE_style_no_code)
+ || command_data(outer).data == BRACE_style_code
+ || command_data(outer).data == BRACE_style_no_code))
|| outer == CM_center
|| outer == CM_exdent
|| outer == CM_item
@@ -1929,7 +1927,6 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
*/
|| (command_data(cmd).flags & CF_ALIAS))
{
- ELEMENT *paragraph;
char *unknown_cmd;
if (cmd)
@@ -1971,10 +1968,8 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
&& ((command_flags(current) & CF_accent)
|| conf.ignore_space_after_braced_command_name))
{
- char *p; char *s;
int whitespaces_len;
int additional_newline = 0;
- KEY_PAIR *k;
whitespaces_len = strspn (line, whitespace_chars);
for (int i = 0; i < whitespaces_len; i++)
@@ -2161,7 +2156,7 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
if (!value)
{
/* Add element for unexpanded @value.
- This should be an error, but still leave a tree element
+ This should be an error, but still leave a tree element
for the converters to handle */
ELEMENT *value_elt;
@@ -2187,12 +2182,12 @@ process_remaining_on_line (ELEMENT **current_inout,
char **line_inout)
}
else
{ /* CM_txiinternalvalue */
- ELEMENT *txiinternalvalue_elt, *txiinternalvalue_arg;
+ ELEMENT *txiinternalvalue_elt;
abort_empty_line (¤t, NULL);
- txiinternalvalue_elt = new_value_element (cmd, flag,
spaces_element);
-
+ txiinternalvalue_elt = new_value_element (cmd, flag,
+ spaces_element);
add_to_element_contents (current, txiinternalvalue_elt);
@@ -2248,7 +2243,7 @@ process_remaining_on_line (ELEMENT **current_inout, char
**line_inout)
&& cmd != CM_item
&& cmd != CM_subentry)))
{
- line_warn ("@%s should only appear at the beginning of a line",
+ line_warn ("@%s should only appear at the beginning of a line",
command_name(cmd));
}
@@ -2548,7 +2543,7 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
|| command_data(current->cmd).data == BLOCK_conditional)
|| (command_data(current->cmd).data == BLOCK_format_raw
&& !format_expanded_p (command_name(current->cmd)))))
- || current->parent && current->parent->cmd == CM_verb)
+ || (current->parent && current->parent->cmd == CM_verb))
&& current_context () != ct_def)
{
ELEMENT *e;
diff --git a/tp/Texinfo/XS/parsetexi/separator.c
b/tp/Texinfo/XS/parsetexi/separator.c
index ec1e48ef16..14df28bbc2 100644
--- a/tp/Texinfo/XS/parsetexi/separator.c
+++ b/tp/Texinfo/XS/parsetexi/separator.c
@@ -357,16 +357,16 @@ handle_close_brace (ELEMENT *current, char **line_inout)
if (ref_label_info->node_content)
destroy_element (ref_label_info->node_content);
}
- if (!link_or_inforef
- && (ref->args.number <= 3
- || ref->args.number <= 4
- && ref->args.list[3]->contents.number == 0
+ if ((!link_or_inforef
+ && (ref->args.number <= 3
+ || (ref->args.number <= 4
+ && ref->args.list[3]->contents.number == 0)
|| (ref->args.list[3]->contents.number == 0
&& ref->args.list[4]->contents.number == 0))
- && !ref_label_info->manual_content
- || link_or_inforef
- && (ref->args.number <= 2
- || ref->args.list[2]->contents.number == 0))
+ && !ref_label_info->manual_content)
+ || (link_or_inforef
+ && (ref->args.number <= 2
+ || ref->args.list[2]->contents.number == 0)))
{
/* we use the @*ref command here and not the label
command to have more information for messages */
diff --git a/tp/Texinfo/XS/parsetexi/tree.c b/tp/Texinfo/XS/parsetexi/tree.c
index 4699c3d80d..f2d69e0454 100644
--- a/tp/Texinfo/XS/parsetexi/tree.c
+++ b/tp/Texinfo/XS/parsetexi/tree.c
@@ -134,7 +134,6 @@ destroy_source_mark_list (SOURCE_MARK_LIST
*source_mark_list)
void
destroy_element (ELEMENT *e)
{
- int i;
free (e->text.text);
/* Note the pointers in these lists are not themselves freed. */
diff --git a/tp/Texinfo/XS/xspara.c b/tp/Texinfo/XS/xspara.c
index 009a160f7d..7b733aab6d 100644
--- a/tp/Texinfo/XS/xspara.c
+++ b/tp/Texinfo/XS/xspara.c
@@ -286,10 +286,10 @@ xspara_init (int unused, char *unused2)
if (!cur)
goto failure;
len = strlen (cur);
- if (len >= 6 && !memcmp (".UTF-8", cur + len - 6, 6)
- || len >= 5 && !memcmp (".utf8", cur + len - 5, 5)
- || len >= 6 && !memcmp (".utf-8", cur + len - 6, 6)
- || len >= 5 && !memcmp (".UTF8", cur + len - 5, 5))
+ if ((len >= 6 && !memcmp (".UTF-8", cur + len - 6, 6))
+ || (len >= 5 && !memcmp (".utf8", cur + len - 5, 5))
+ || (len >= 6 && !memcmp (".utf-8", cur + len - 6, 6))
+ || (len >= 5 && !memcmp (".UTF8", cur + len - 5, 5)))
{
setlocale (LC_CTYPE, ""); /* Use the locale from the environment. */
goto success;
@@ -501,11 +501,11 @@ xspara_get_state (HV *hash)
SV *val;
+ dTHX; /* Perl boilerplate. */
+
/* Don't do anything. */
return;
- dTHX; /* Perl boilerplate. */
-
val = newSViv (state.end_sentence);
STORE("end_sentence");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): free fullpath only after error messages have been output.,
Patrice Dumas <=