[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs (get_index_e
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs (get_index_entries_sorted_by_letter), tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter): use INDEX ** in argument of get_sv_index_entries_sorted_by_letter and return an INDEX_SORTED_BY_LETTER ** instead of modifying a converter. |
Date: |
Tue, 07 Nov 2023 16:51:25 -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 4fd8752dbb * tp/Texinfo/XS/convert/ConvertXS.xs
(get_index_entries_sorted_by_letter), tp/Texinfo/XS/main/get_perl_info.c
(get_sv_index_entries_sorted_by_letter): use INDEX ** in argument of
get_sv_index_entries_sorted_by_letter and return an INDEX_SORTED_BY_LETTER **
instead of modifying a converter.
4fd8752dbb is described below
commit 4fd8752dbb28cab5b65ecf17fb76e6f7bdae84ce
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Nov 7 22:51:12 2023 +0100
* tp/Texinfo/XS/convert/ConvertXS.xs
(get_index_entries_sorted_by_letter),
tp/Texinfo/XS/main/get_perl_info.c
(get_sv_index_entries_sorted_by_letter): use INDEX ** in argument of
get_sv_index_entries_sorted_by_letter and return an
INDEX_SORTED_BY_LETTER ** instead of modifying a converter.
---
ChangeLog | 9 +++++++++
tp/Texinfo/XS/convert/ConvertXS.xs | 6 +++++-
tp/Texinfo/XS/main/get_perl_info.c | 25 ++++++++++++++-----------
tp/Texinfo/XS/main/get_perl_info.h | 4 ++--
4 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f1bd119857..2d07865e84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-11-07 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs
+ (get_index_entries_sorted_by_letter),
+ tp/Texinfo/XS/main/get_perl_info.c
+ (get_sv_index_entries_sorted_by_letter): use INDEX ** in argument of
+ get_sv_index_entries_sorted_by_letter and return an
+ INDEX_SORTED_BY_LETTER ** instead of modifying a converter.
+
2023-11-07 Patrice Dumas <pertusus@free.fr>
* tp/t/html_tests.t (mathjax_with_texinfo)
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index 2fd5d6ca2b..b23d56808c 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -65,11 +65,15 @@ void
get_index_entries_sorted_by_letter (SV *converter_in, SV
*index_entries_sorted_by_letter)
PREINIT:
CONVERTER *self;
+ INDEX_SORTED_BY_LETTER **index_entries_by_letter;
CODE:
self = get_sv_converter (converter_in,
"get_index_entries_sorted_by_letter");
- get_sv_index_entries_sorted_by_letter (self,
+ index_entries_by_letter
+ = get_sv_index_entries_sorted_by_letter
+ (self->document->index_names,
index_entries_sorted_by_letter);
+ self->index_entries_by_letter = index_entries_by_letter;
# pass the stream of an unclosed file path.
# tried with OutputStream instead of FILE, but it did not work, there
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index 10a85dcbd9..694b4a8610 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -419,10 +419,13 @@ set_output_converter_sv (SV *sv_in, char *warn_string)
/* code in comments allow to sort the index names to have a fixed order
in the data structure. Not clear that it is useful or not, not enabled
for now */
-void
-get_sv_index_entries_sorted_by_letter (CONVERTER *converter,
+/* return value to be freed by caller */
+INDEX_SORTED_BY_LETTER **
+get_sv_index_entries_sorted_by_letter (INDEX **index_names,
SV *index_entries_sorted_by_letter)
{
+ INDEX_SORTED_BY_LETTER **index_entries_by_letter;
+
HV *hv_in;
/* for sorted index names
AV *index_names_av;
@@ -433,12 +436,11 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
I32 index_names_nr;
SSize_t j;
- INDEX **index_names = converter->document->index_names;
dTHX;
if (!SvOK (index_entries_sorted_by_letter))
- return;
+ return 0;
hv_in = (HV *)SvRV (index_entries_sorted_by_letter);
@@ -447,7 +449,7 @@ get_sv_index_entries_sorted_by_letter (CONVERTER *converter,
/* when there is a memcpy just below, a condition that avoids negative
index_names_nr is important to avoid a gcc warning */
if (index_names_nr <= 0)
- return;
+ return 0;
/* doing an AV with the keys (first step of sorting)
index_names_av = newAV ();
@@ -468,7 +470,7 @@ get_sv_index_entries_sorted_by_letter (CONVERTER *converter,
sortsv (sorted_index_names_av_array, index_names_nr, Perl_sv_cmp);
*/
- converter->index_entries_by_letter = (INDEX_SORTED_BY_LETTER **)
+ index_entries_by_letter = (INDEX_SORTED_BY_LETTER **)
malloc (index_names_nr * sizeof (INDEX_SORTED_BY_LETTER *));
for (j = 0; j < index_names_nr; j++)
@@ -529,22 +531,22 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
fatal (msg);
}
- converter->index_entries_by_letter[j] = (INDEX_SORTED_BY_LETTER *)
+ index_entries_by_letter[j] = (INDEX_SORTED_BY_LETTER *)
malloc (sizeof (INDEX_SORTED_BY_LETTER));
- converter->index_entries_by_letter[j]->name = strdup (idx_name);
+ index_entries_by_letter[j]->name = strdup (idx_name);
av = (AV *)SvRV (sorted_by_letter_sv);
letter_entries_nr = av_top_index (av) +1;
- converter->index_entries_by_letter[j]->number = letter_entries_nr;
- converter->index_entries_by_letter[j]->letter_entries
+ index_entries_by_letter[j]->number = letter_entries_nr;
+ index_entries_by_letter[j]->letter_entries
= (LETTER_INDEX_ENTRIES *)
malloc (letter_entries_nr * sizeof (LETTER_INDEX_ENTRIES));
for (i = 0; i < letter_entries_nr; i++)
{
SV** letter_entries_sv = av_fetch (av, i, 0);
LETTER_INDEX_ENTRIES *letter_entries
- = &converter->index_entries_by_letter[j]->letter_entries[i];
+ = &index_entries_by_letter[j]->letter_entries[i];
if (letter_entries_sv)
{
int k;
@@ -628,6 +630,7 @@ get_sv_index_entries_sorted_by_letter (CONVERTER *converter,
}
}
}
+ return index_entries_by_letter;
}
void
diff --git a/tp/Texinfo/XS/main/get_perl_info.h
b/tp/Texinfo/XS/main/get_perl_info.h
index b982c3700d..7cb39c2aa5 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -27,8 +27,8 @@ CONVERTER *get_sv_converter (SV *sv_in, char *warn_string);
CONVERTER *converter_initialize (SV *converter_sv);
-void get_sv_index_entries_sorted_by_letter (CONVERTER *converter,
- SV
*index_entries_sorted_by_letter);
+INDEX_SORTED_BY_LETTER **get_sv_index_entries_sorted_by_letter
+ (INDEX **index_names, SV *index_entries_sorted_by_letter);
TEXT_OPTIONS *copy_sv_options_for_convert_text (SV *sv_in);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/convert/ConvertXS.xs (get_index_entries_sorted_by_letter), tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter): use INDEX ** in argument of get_sv_index_entries_sorted_by_letter and return an INDEX_SORTED_BY_LETTER ** instead of modifying a converter.,
Patrice Dumas <=