[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/main/manipulate_tree.c (copy_asso
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/main/manipulate_tree.c (copy_associated_info) (copy_tree_internal, remove_associated_copy_info, parse_node_manual) (modify_tree, normalized_menu_entry_internal_node, first_menu_node), tp/Texinfo/XS/main/tree.c (destroy_associated_info) (destroy_source_mark_list, destroy_element_and_children) (remove_element_from_list, add_element_if_not_in_list) (replace_element_in_list, next_bracketed_or_word_agg) (split_delimiters, split_def_args, parse_def), tp/Texinfo/XS/structuring_tra [...] |
Date: |
Fri, 04 Oct 2024 06:21:13 -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 70e1ef8c5c * tp/Texinfo/XS/main/manipulate_tree.c
(copy_associated_info) (copy_tree_internal, remove_associated_copy_info,
parse_node_manual) (modify_tree, normalized_menu_entry_internal_node,
first_menu_node), tp/Texinfo/XS/main/tree.c (destroy_associated_info)
(destroy_source_mark_list, destroy_element_and_children)
(remove_element_from_list, add_element_if_not_in_list)
(replace_element_in_list, next_bracketed_or_word_agg) (split_delimiters,
split_def_args, parse_def), tp/Texin [...]
70e1ef8c5c is described below
commit 70e1ef8c5c819abba83abbef8505106831c93963
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 11 17:15:09 2024 +0200
* tp/Texinfo/XS/main/manipulate_tree.c (copy_associated_info)
(copy_tree_internal, remove_associated_copy_info, parse_node_manual)
(modify_tree, normalized_menu_entry_internal_node, first_menu_node),
tp/Texinfo/XS/main/tree.c (destroy_associated_info)
(destroy_source_mark_list, destroy_element_and_children)
(remove_element_from_list, add_element_if_not_in_list)
(replace_element_in_list, next_bracketed_or_word_agg)
(split_delimiters, split_def_args, parse_def),
tp/Texinfo/XS/structuring_transfo/structuring.c
(insert_menu_comment_content, new_complete_node_menu): replace int by
size_t in situations where the variable could reach a value outside of
the int range and also when the index is better reprensented by a
size_t.
---
ChangeLog | 16 +++++++++
tp/TODO | 5 +--
tp/Texinfo/XS/main/manipulate_tree.c | 44 +++++++++++++------------
tp/Texinfo/XS/main/tree.c | 20 +++++------
tp/Texinfo/XS/parsetexi/def.c | 19 ++++++-----
tp/Texinfo/XS/structuring_transfo/structuring.c | 4 +--
6 files changed, 64 insertions(+), 44 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 892d387380..ca9c27ec1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-08-11 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/manipulate_tree.c (copy_associated_info)
+ (copy_tree_internal, remove_associated_copy_info, parse_node_manual)
+ (modify_tree, normalized_menu_entry_internal_node, first_menu_node),
+ tp/Texinfo/XS/main/tree.c (destroy_associated_info)
+ (destroy_source_mark_list, destroy_element_and_children)
+ (remove_element_from_list, add_element_if_not_in_list)
+ (replace_element_in_list, next_bracketed_or_word_agg)
+ (split_delimiters, split_def_args, parse_def),
+ tp/Texinfo/XS/structuring_transfo/structuring.c
+ (insert_menu_comment_content, new_complete_node_menu): replace int by
+ size_t in situations where the variable could reach a value outside of
+ the int range and also when the index is better reprensented by a
+ size_t.
+
2024-08-11 Patrice Dumas <pertusus@free.fr>
Fix compiler warnings
diff --git a/tp/TODO b/tp/TODO
index b7e0d0398d..a08eb334c3 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -886,15 +886,16 @@ SUM: 98
Setting flags
+# some features are only enabled at -O2, but sometime -O0 is better
+# for debugging with valgrind
our_CFLAGS='-g -O0 -Wformat-security -Wstrict-prototypes -Wall
-Wno-parentheses -Wno-missing-braces'
# Without -Wstack-protector there is no message on functions not protected.
# All these are in gnulib or gettext for now.
# -fno-omit-frame-pointer is better for debugging with valgrind, but has
# some speed penalty
-# some features are only enabled at -O2, but sometime -O0 is better
-# for debugging with valgrind
our_CFLAGS='-g -O2 -D_FORTIFY_SOURCE=2 -Wformat-security -Wstrict-prototypes
-Wall -Wno-parentheses -Wno-missing-braces -Wno-unused-parameter
-fstack-protector-all -Wextra -Wno-sign-compare -fno-omit-frame-pointer'
our_CFLAGS='-g -O2 -Wformat-security -Wstrict-prototypes -Wall
-Wno-parentheses -Wno-missing-braces -Wno-unused-parameter -Wextra
-Wno-sign-compare'
+our_CFLAGS='-g -O2 -Wformat-security -Wstrict-prototypes -Wall
-Wno-parentheses -Wno-missing-braces -Wno-unused-parameter -Wextra'
./configure "CFLAGS=$our_CFLAGS" "PERL_EXT_CFLAGS=$our_CFLAGS"
unset our_CFLAGS
diff --git a/tp/Texinfo/XS/main/manipulate_tree.c
b/tp/Texinfo/XS/main/manipulate_tree.c
index 28236abad5..232d43c361 100644
--- a/tp/Texinfo/XS/main/manipulate_tree.c
+++ b/tp/Texinfo/XS/main/manipulate_tree.c
@@ -49,13 +49,13 @@ copy_tree_internal (ELEMENT* current);
void
copy_associated_info (ASSOCIATED_INFO *info, ASSOCIATED_INFO* new_info)
{
- int i;
+ size_t i;
for (i = 0; i < info->info_number; i++)
{
const KEY_PAIR *k_ref = &info->info[i];
enum ai_key_name key = k_ref->key;
- int j;
+ size_t j;
if (k_ref->type == extra_deleted)
continue;
@@ -167,7 +167,7 @@ ELEMENT *
copy_tree_internal (ELEMENT* current)
{
ELEMENT *new;
- int i;
+ size_t i;
int elt_info_nr = type_data[current->type].elt_info_number;
if (current->flags & EF_copy)
@@ -220,25 +220,27 @@ copy_tree_internal (ELEMENT* current)
if (elt_info_nr > 0)
{
- for (i = 0; i < elt_info_nr; i++)
- if (current->elt_info[i])
+ int j;
+ for (j = 0; j < elt_info_nr; j++)
+ if (current->elt_info[j])
{
- ELEMENT *copy = copy_tree_internal (current->elt_info[i]);
- new->elt_info[i] = copy;
+ ELEMENT *copy = copy_tree_internal (current->elt_info[j]);
+ new->elt_info[j] = copy;
}
}
if (current->e.c->string_info)
{
+ int j;
int string_info_nr = 1;
if (current->type == ET_definfoenclose_command
|| current->type == ET_index_entry_command
|| current->type == ET_lineraw_command
|| current->e.c->cmd == CM_verb)
string_info_nr = 2;
- for (i = 0; i < string_info_nr; i++)
- if (current->e.c->string_info[i])
- new->e.c->string_info[i] = strdup (current->e.c->string_info[i]);
+ for (j = 0; j < string_info_nr; j++)
+ if (current->e.c->string_info[j])
+ new->e.c->string_info[j] = strdup (current->e.c->string_info[j]);
}
copy_associated_info (¤t->e.c->extra_info, &new->e.c->extra_info);
@@ -251,12 +253,12 @@ remove_element_copy_info (ELEMENT *current);
void
remove_associated_copy_info (ASSOCIATED_INFO *info)
{
- int i;
+ size_t i;
for (i = 0; i < info->info_number; i++)
{
const KEY_PAIR *k_ref = &info->info[i];
- int j;
+ size_t j;
if (k_ref->type == extra_deleted)
continue;
@@ -320,7 +322,7 @@ remove_associated_copy_info (ASSOCIATED_INFO *info)
void
remove_element_copy_info (ELEMENT *current)
{
- int i;
+ size_t i;
int elt_info_nr;
if (! (current->flags & EF_copy))
@@ -565,7 +567,7 @@ parse_node_manual (ELEMENT *node, int modify_node)
{
NODE_SPEC_EXTRA *result;
ELEMENT *node_content = 0;
- int idx = 0; /* index into node->e.c->contents */
+ size_t idx = 0; /* index into node->e.c->contents */
result = malloc (sizeof (NODE_SPEC_EXTRA));
result->manual_content = result->node_content = 0;
@@ -832,7 +834,7 @@ modify_tree (ELEMENT *tree,
{
if (tree->e.c->args.number > 0)
{
- int i;
+ size_t i;
for (i = 0; i < tree->e.c->args.number; i++)
{
ELEMENT_LIST *new_args;
@@ -854,7 +856,7 @@ modify_tree (ELEMENT *tree,
}
if (tree->e.c->contents.number > 0)
{
- int i;
+ size_t i;
for (i = 0; i < tree->e.c->contents.number; i++)
{
ELEMENT *content = tree->e.c->contents.list[i];
@@ -876,7 +878,7 @@ modify_tree (ELEMENT *tree,
}
if (tree->source_mark_list != 0)
{
- int i;
+ size_t i;
for (i = 0; i < tree->source_mark_list->number; i++)
{
if (tree->source_mark_list->list[i]->element)
@@ -1070,7 +1072,7 @@ protect_node_after_label_in_tree (ELEMENT *tree)
const char *
normalized_menu_entry_internal_node (const ELEMENT *entry)
{
- int i;
+ size_t i;
for (i = 0; i < entry->e.c->contents.number; i++)
{
const ELEMENT *content = entry->e.c->contents.list[i];
@@ -1106,17 +1108,17 @@ first_menu_node (const ELEMENT *node, const LABEL_LIST
*identifiers_target)
const CONST_ELEMENT_LIST *menus = lookup_extra_contents (node, AI_key_menus);
if (menus)
{
- int i;
+ size_t i;
for (i = 0; i < menus->number; i++)
{
const ELEMENT *menu = menus->list[i];
- int j;
+ size_t j;
for (j = 0; j < menu->e.c->contents.number; j++)
{
const ELEMENT *menu_content = menu->e.c->contents.list[j];
if (menu_content->type == ET_menu_entry)
{
- int k;
+ size_t k;
const ELEMENT *menu_node
= normalized_entry_associated_internal_node (menu_content,
identifiers_target);
diff --git a/tp/Texinfo/XS/main/tree.c b/tp/Texinfo/XS/main/tree.c
index 086ef1bd54..e83f7816bf 100644
--- a/tp/Texinfo/XS/main/tree.c
+++ b/tp/Texinfo/XS/main/tree.c
@@ -180,7 +180,7 @@ destroy_const_element_list (CONST_ELEMENT_LIST *list)
void
destroy_associated_info (ASSOCIATED_INFO *a)
{
- int i;
+ size_t i;
for (i = 0; i < a->info_number; i++)
{
@@ -229,7 +229,7 @@ destroy_source_mark (SOURCE_MARK *source_mark)
void
destroy_source_mark_list (SOURCE_MARK_LIST *source_mark_list)
{
- int i;
+ size_t i;
for (i = 0; i < source_mark_list->number; i++)
destroy_source_mark (source_mark_list->list[i]);
@@ -310,7 +310,7 @@ destroy_element (ELEMENT *e)
void
destroy_element_and_children (ELEMENT *e)
{
- int i;
+ size_t i;
if (! (type_data[e->type].flags & TF_text))
{
@@ -557,18 +557,18 @@ remove_from_args (ELEMENT *parent, int where)
ELEMENT *
remove_element_from_list (ELEMENT_LIST *list, const ELEMENT *e)
{
- int i;
- int index = -1;
+ size_t i;
+ int found = 0;
for (i = 0; i < list->number; i++)
{
if (list->list[i] == e)
{
- index = i;
+ found = 1;
break;
}
}
- if (index >= 0)
- return remove_from_element_list (list, index);
+ if (found)
+ return remove_from_element_list (list, i);
return 0;
}
@@ -576,7 +576,7 @@ remove_element_from_list (ELEMENT_LIST *list, const ELEMENT
*e)
void
add_element_if_not_in_list (ELEMENT_LIST *list, ELEMENT *e)
{
- int i;
+ size_t i;
for (i = 0; i < list->number; i++)
{
if (list->list[i] == e)
@@ -664,7 +664,7 @@ args_child_by_index (const ELEMENT *e, int index)
int replace_element_in_list (ELEMENT_LIST *list, ELEMENT *removed,
ELEMENT *added)
{
- int i;
+ size_t i;
if (!list || !list->number)
return 0;
diff --git a/tp/Texinfo/XS/parsetexi/def.c b/tp/Texinfo/XS/parsetexi/def.c
index f71d1ce595..84b8caf790 100644
--- a/tp/Texinfo/XS/parsetexi/def.c
+++ b/tp/Texinfo/XS/parsetexi/def.c
@@ -102,12 +102,12 @@ gather_def_item (ELEMENT *current, enum command_id
next_command)
/* Starting at I in the contents, return the next non-whitespace element,
incrementing I. Return null if no more elements. */
ELEMENT *
-next_bracketed_or_word_agg (ELEMENT *current, int *i)
+next_bracketed_or_word_agg (ELEMENT *current, size_t *i)
{
- int num = 0;
+ size_t num = 0;
ELEMENT *new;
ELEMENT *e;
- int j;
+ size_t j;
while (1)
{
if (*i == current->e.c->contents.number)
@@ -199,9 +199,9 @@ DEF_MAP def_maps[] = {
/* Split non-space text elements into strings without [ ] ( ) , and single
character strings with one of them. */
static void
-split_delimiters (ELEMENT *current, int starting_idx)
+split_delimiters (ELEMENT *current, size_t starting_idx)
{
- int i;
+ size_t i;
static char *chars = "[](),";
for (i = starting_idx; i < current->e.c->contents.number; i++)
{
@@ -287,9 +287,9 @@ split_delimiters (ELEMENT *current, int starting_idx)
/* Divide any text elements into separate elements, separating whitespace
and non-whitespace. */
static void
-split_def_args (ELEMENT *current, int starting_idx)
+split_def_args (ELEMENT *current, size_t starting_idx)
{
- int i;
+ size_t i;
for (i = starting_idx; i < current->e.c->contents.number; i++)
{
ELEMENT *e = current->e.c->contents.list[i];
@@ -355,9 +355,10 @@ split_def_args (ELEMENT *current, int starting_idx)
void
parse_def (enum command_id command, ELEMENT *current)
{
- int contents_idx = 0;
+ size_t contents_idx = 0;
int type, set_type_not_arg;
- int i, i_def;
+ size_t i;
+ int i_def;
int arg_types_nr;
ELEMENT *e, *e1;
enum element_type *arguments_types_list;
diff --git a/tp/Texinfo/XS/structuring_transfo/structuring.c
b/tp/Texinfo/XS/structuring_transfo/structuring.c
index e70ecc65e5..8b6c7c2d6d 100644
--- a/tp/Texinfo/XS/structuring_transfo/structuring.c
+++ b/tp/Texinfo/XS/structuring_transfo/structuring.c
@@ -1790,7 +1790,7 @@ new_node_menu_entry (const ELEMENT *node, int
use_sections)
}
static void
-insert_menu_comment_content (ELEMENT_LIST *element_list, int position,
+insert_menu_comment_content (ELEMENT_LIST *element_list, size_t position,
ELEMENT *inserted_element, int no_leading_empty_line)
{
ELEMENT *menu_comment = new_element (ET_menu_comment);
@@ -1862,7 +1862,7 @@ new_complete_node_menu (const ELEMENT *node, DOCUMENT
*document,
const char *normalized = lookup_extra_string (node, AI_key_normalized);
if (normalized && !strcmp (normalized, "Top"))
{
- int content_index = 0;
+ size_t content_index = 0;
int in_appendix = 0;
for (i = 0; i < node_childs->number; i++)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/main/manipulate_tree.c (copy_associated_info) (copy_tree_internal, remove_associated_copy_info, parse_node_manual) (modify_tree, normalized_menu_entry_internal_node, first_menu_node), tp/Texinfo/XS/main/tree.c (destroy_associated_info) (destroy_source_mark_list, destroy_element_and_children) (remove_element_from_list, add_element_if_not_in_list) (replace_element_in_list, next_bracketed_or_word_agg) (split_delimiters, split_def_args, parse_def), tp/Texinfo/XS/structuring_tra [...],
Patrice Dumas <=