[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Wed, 2 Oct 2024 12:33:28 -0400 (EDT) |
branch: master
commit f9fee24d762a19f66d1583a52172a1e9a2bf103d
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 3 18:18:27 2024 +0200
* tp/Texinfo/XS/main/utils.c (find_option_string): return 0 if not
found.
* tp/Texinfo/XS/main/utils.c (set_sorted_option_key_configured): set
configured on an OPTION found by name using find_option_string.
* tp/Texinfo/XS/main/get_perl_info.c (get_sv_configured_options)
(converter_initialize_sv): use set_sorted_option_key_configured.
---
ChangeLog | 11 +++++++++++
tp/Texinfo/XS/main/get_perl_info.c | 8 +++++---
tp/Texinfo/XS/main/get_perl_info.h | 1 -
tp/Texinfo/XS/main/utils.c | 19 ++++++++++++++++++-
tp/Texinfo/XS/main/utils.h | 3 +++
tp/maintain/regenerate_C_options_info.pl | 1 +
6 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0e8ad74f6f..d21116e2c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-08-03 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/main/utils.c (find_option_string): return 0 if not
+ found.
+
+ * tp/Texinfo/XS/main/utils.c (set_sorted_option_key_configured): set
+ configured on an OPTION found by name using find_option_string.
+
+ * tp/Texinfo/XS/main/get_perl_info.c (get_sv_configured_options)
+ (converter_initialize_sv): use set_sorted_option_key_configured.
+
2024-08-03 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/main/utils.c (compare_option_str, initialize_option),
diff --git a/tp/Texinfo/XS/main/get_perl_info.c
b/tp/Texinfo/XS/main/get_perl_info.c
index 7060a7f095..c6baec15c1 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -402,8 +402,9 @@ get_sv_options (SV *sv, OPTIONS *options, CONVERTER
*converter,
}
}
+/* Unused */
void
-get_sv_configured_options (SV *configured_sv_in, OPTIONS *options)
+get_sv_configured_options (SV *configured_sv_in, OPTION **sorted_options)
{
I32 hv_number;
I32 i;
@@ -422,7 +423,7 @@ get_sv_configured_options (SV *configured_sv_in, OPTIONS
*options)
if (value && SvOK (value))
{
int configured = SvIV (value);
- set_option_key_configured (options, key, configured);
+ set_sorted_option_key_configured (sorted_options, key, configured);
}
}
}
@@ -518,7 +519,8 @@ converter_initialize_sv (SV *converter_sv, CONVERTER
*converter,
*/
if (!status)
{
- set_option_key_configured (converter->conf, key, 1);
+ set_sorted_option_key_configured (converter->sorted_options,
+ key, 1);
}
/* TODO in defaults here means in format_defaults or
non customization variable
diff --git a/tp/Texinfo/XS/main/get_perl_info.h
b/tp/Texinfo/XS/main/get_perl_info.h
index db0bf4e434..bccd435f7f 100644
--- a/tp/Texinfo/XS/main/get_perl_info.h
+++ b/tp/Texinfo/XS/main/get_perl_info.h
@@ -48,7 +48,6 @@ SOURCE_INFO *get_source_info (SV *source_info_sv);
void get_line_message (CONVERTER *self, enum error_type type, int continuation,
SV *error_location_info, const char *message);
OPTIONS *init_copy_sv_options (SV *sv_in, CONVERTER *converter, int force);
-void get_sv_configured_options (SV *configured_sv_in, OPTIONS *options);
void copy_converter_conf_sv (HV *hv, CONVERTER *converter,
OPTIONS **conf, const char *conf_key, int force);
int set_sv_conf (CONVERTER *converter, const char *conf, SV *value);
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index 1fed3945a3..e07b8f66bf 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -1738,7 +1738,10 @@ find_option_string (OPTION **sorted_options, const char
*name)
option_key.name = name;
result = (OPTION **)bsearch (&option_ref, sorted_options, TXI_OPTIONS_NR,
sizeof (OPTION *), compare_option_str);
- return *result;
+ if (result)
+ return *result;
+ else
+ return 0;
}
void
@@ -1980,6 +1983,20 @@ copy_option (OPTION *destination, const OPTION *source)
}
}
+void
+set_sorted_option_key_configured (OPTION **sorted_options, const char *key,
+ int configured)
+{
+
+ if (configured > 0)
+ {
+ OPTION *option = find_option_string (sorted_options, key);
+
+ if (option)
+ option->configured = configured;
+ }
+}
+
/* constructors in particular called from files including perl headers */
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index f54f73c10d..f87b739f4e 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -216,6 +216,9 @@ void copy_options (OPTIONS *destination, const OPTIONS
*source);
OPTIONS *new_options (void);
OPTION **setup_sorted_options (OPTIONS *options);
OPTION *find_option_string (OPTION **sorted_options, const char *name);
+void set_sorted_option_key_configured (OPTION **sorted_options,
+ const char *key, int configured);
+
void set_output_encoding (OPTIONS *customization_information,
DOCUMENT *document);
OPTION *get_command_option (OPTIONS *options, enum command_id cmd);
diff --git a/tp/maintain/regenerate_C_options_info.pl
b/tp/maintain/regenerate_C_options_info.pl
index 563913a4d7..aef48e94fd 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -257,6 +257,7 @@ foreach my $category (sort(keys(%option_categories))) {
print CODE "}\n\n";
# set configured based on the name
+# NOTE currently unused, as there is another function that uses a bsearch
print CODE 'void
set_option_key_configured (OPTIONS *options, const char *key, int configured)
{