[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_sort_index_entries
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_sort_index_entries), tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter): encode strings in get_sv_index_entries_sorted_by_letter by using SvPVutf8 instead of doing it in perl. |
Date: |
Sun, 05 Nov 2023 14:54:41 -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 dc46dbb84b * tp/Texinfo/Convert/HTML.pm (_sort_index_entries),
tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter):
encode strings in get_sv_index_entries_sorted_by_letter by using SvPVutf8
instead of doing it in perl.
dc46dbb84b is described below
commit dc46dbb84bc5d8ab23051b6bd2a8f3e9e3204e93
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 5 20:54:33 2023 +0100
* tp/Texinfo/Convert/HTML.pm (_sort_index_entries),
tp/Texinfo/XS/main/get_perl_info.c
(get_sv_index_entries_sorted_by_letter): encode strings in
get_sv_index_entries_sorted_by_letter by using SvPVutf8 instead of
doing it in perl.
---
ChangeLog | 8 ++++++++
tp/Texinfo/Convert/HTML.pm | 15 ++++++---------
tp/Texinfo/XS/main/get_perl_info.c | 33 ++++++++++++++++-----------------
3 files changed, 30 insertions(+), 26 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 87321961d1..4aba8d307d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-05 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_sort_index_entries),
+ tp/Texinfo/XS/main/get_perl_info.c
+ (get_sv_index_entries_sorted_by_letter): encode strings in
+ get_sv_index_entries_sorted_by_letter by using SvPVutf8 instead of
+ doing it in perl.
+
2023-11-05 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries),
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 11691aa253..901a1f1449 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9865,26 +9865,23 @@ sub _sort_index_entries($)
# pass sorted index entries to XS for a reproducible sorting.
if ($self->{'converter_descriptor'} and $XS_convert) {
- # encode. Also setup list of lists for easier import of data in C.
- my $encoded_index_entries_by_letter = [];
+ # Setup list of lists for easier import of data in C.
+ my $index_entries_by_letter = [];
if ($self->{'index_entries_by_letter'}) {
foreach my $index_name
(sort(keys(%{$self->{'index_entries_by_letter'}}))) {
my $letter_entries
= $self->{'index_entries_by_letter'}->{$index_name};
- my $encoded_index_by_letters = [];
+ my $index_by_letters = [];
foreach my $letter_entry (@$letter_entries) {
my $letter = $letter_entry->{'letter'};
- push @$encoded_index_by_letters,
- [Encode::encode('UTF-8', $letter), $letter_entry->{'entries'}];
+ push @$index_by_letters, [$letter, $letter_entry->{'entries'}];
}
- push @$encoded_index_entries_by_letter,
- [Encode::encode('UTF-8', $index_name),
- $encoded_index_by_letters];
+ push @$index_entries_by_letter, [$index_name, $index_by_letters];
}
}
_XS_get_index_entries_sorted_by_letter($self,
- $encoded_index_entries_by_letter);
+ $index_entries_by_letter);
}
}
}
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index b8dfe38af5..b381a2276b 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -1452,13 +1452,13 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
int i;
char *idx_name = 0;
SSize_t letter_entries_nr;
- AV *index_encoded_sorted_by_letter_av;
+ AV *index_sorted_by_letter_av;
SV **idx_name_sv;
- SV **encoded_sorted_by_letter_sv;
+ SV **sorted_by_letter_sv;
AV *av;
- SV **index_encoded_sorted_by_letter_sv = av_fetch (av_in, j, 0);
- if (!index_encoded_sorted_by_letter_sv)
+ SV **index_sorted_by_letter_sv = av_fetch (av_in, j, 0);
+ if (!index_sorted_by_letter_sv)
{
char *msg;
xasprintf (&msg,
@@ -1466,10 +1466,10 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
fatal (msg);
}
- index_encoded_sorted_by_letter_av
- = (AV *)SvRV (*index_encoded_sorted_by_letter_sv);
+ index_sorted_by_letter_av
+ = (AV *)SvRV (*index_sorted_by_letter_sv);
- idx_name_sv = av_fetch (index_encoded_sorted_by_letter_av, 0, 0);
+ idx_name_sv = av_fetch (index_sorted_by_letter_av, 0, 0);
if (!idx_name_sv)
{
char *msg;
@@ -1477,11 +1477,11 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
"get_sv_index_entries_sorted_by_letter: %d: no index name\n", j);
fatal (msg);
}
- idx_name = (char *) SvPVbyte_nolen (*idx_name_sv);
+ idx_name = (char *) SvPVutf8_nolen (*idx_name_sv);
- encoded_sorted_by_letter_sv
- = av_fetch (index_encoded_sorted_by_letter_av, 1, 0);
- if (!encoded_sorted_by_letter_sv)
+ sorted_by_letter_sv
+ = av_fetch (index_sorted_by_letter_av, 1, 0);
+ if (!sorted_by_letter_sv)
{
char *msg;
xasprintf (&msg,
@@ -1494,7 +1494,7 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
malloc (sizeof (INDEX_SORTED_BY_LETTER));
converter->index_entries_by_letter[j]->name = strdup (idx_name);
- av = (AV *)SvRV (*encoded_sorted_by_letter_sv);
+ 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;
@@ -1512,9 +1512,9 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
SSize_t entries_nr;
AV *entries_av;
AV *letter_entries_av = (AV *) SvRV (*letter_entries_sv);
- SV **encoded_letter_sv = av_fetch (letter_entries_av, 0, 0);
+ SV **letter_sv = av_fetch (letter_entries_av, 0, 0);
SV **entries_sv = av_fetch (letter_entries_av, 1, 0);
- if (!encoded_letter_sv || !entries_sv)
+ if (!letter_sv || !entries_sv)
{
char *msg;
xasprintf (&msg,
@@ -1523,7 +1523,7 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
fatal (msg);
}
letter_entries->letter
- = (char *) SvPVbyte_nolen (*encoded_letter_sv);
+ = (char *) SvPVutf8_nolen (*letter_sv);
entries_av = (AV *) SvRV (*entries_sv);
entries_nr = av_top_index (entries_av) +1;
@@ -1562,8 +1562,7 @@ get_sv_index_entries_sorted_by_letter (CONVERTER
*converter,
idx_name, i, letter_entries->letter, k);
fatal (msg);
}
- /* FIXME probably not SvPVbyte_nolen as entered as
newSVpv_utf8 */
- entry_index_name = (char *) SvPVbyte_nolen (*index_name_sv);
+ entry_index_name = (char *) SvPVutf8_nolen (*index_name_sv);
entry_number = SvIV (*entry_number_sv);
for (n = index_names; (idx = *n); n++)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_sort_index_entries), tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter): encode strings in get_sv_index_entries_sorted_by_letter by using SvPVutf8 instead of doing it in perl.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries), tp/Texinfo/XS/convert/ConvertXS.xs (sort_sortable_index_entries_by_letter), tp/Texinfo/XS/convert/indices_in_conversion.c (sort_indices_by_letter): remove code related to sorting in C based on sortable entries from perl, as it is unfinished because it requires a collation function in C, and the passing of data from perl need to be redone, it would be better to restart from scratch.
- Next by Date:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_sort_index_entries), tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter): pass index entries by letter directly as a hash.
- Previous by thread:
branch master updated: * tp/Texinfo/Convert/HTML.pm (import, _sort_index_entries), tp/Texinfo/XS/convert/ConvertXS.xs (sort_sortable_index_entries_by_letter), tp/Texinfo/XS/convert/indices_in_conversion.c (sort_indices_by_letter): remove code related to sorting in C based on sortable entries from perl, as it is unfinished because it requires a collation function in C, and the passing of data from perl need to be redone, it would be better to restart from scratch.
- Next by thread:
branch master updated: * tp/Texinfo/Convert/HTML.pm (_sort_index_entries), tp/Texinfo/XS/main/get_perl_info.c (get_sv_index_entries_sorted_by_letter): pass index entries by letter directly as a hash.
- Index(es):