[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Thu, 14 Nov 2024 16:50:19 -0500 (EST) |
branch: master
commit 99857003012545cc363aa80a20745cb223813121
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Nov 14 22:50:08 2024 +0100
* tp/Texinfo/XS/XSParagraph.xs (xspara_new): iterate over the conf
hash keys instead of trying all the variables. It should be faster if
there are only few variables set (not if lots of variables are set, as
there is a linear search to determine the function to call).
---
ChangeLog | 27 +++++++++++++++++----------
tp/Texinfo/XS/XSParagraph.xs | 29 +++++++++++++++++++++++------
2 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6a1c3441d3..32ecbb2ed1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,14 +1,9 @@
-2024-11-14 Gavin Smith <gavinsmith0123@gmail.com>
-
- Escape non-ASCII bytes in reference test results
-
- * tp/tests/escape_file_names.pl: New file.
- * tp/tests/run_parser_all.sh (escape_file_names): Add, and
- run escape_file_names.pl on all files in output directory.
+2024-11-14 Patrice Dumas <pertusus@free.fr>
- This reduces the number of files with non-ASCII file namess
- in the sources which can cause problems on some unusual platforms.
- Report from Eli.
+ * tp/Texinfo/XS/XSParagraph.xs (xspara_new): iterate over the conf
+ hash keys instead of trying all the variables. It should be faster if
+ there are only few variables set (not if lots of variables are set, as
+ there is a linear search to determine the function to call).
2024-11-14 Patrice Dumas <pertusus@free.fr>
@@ -28,6 +23,18 @@
variable using the SET_CONF macro in xspara.c and xspara.h. Remove
xspara_init_state.
+2024-11-14 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Escape non-ASCII bytes in reference test results
+
+ * tp/tests/escape_file_names.pl: New file.
+ * tp/tests/run_parser_all.sh (escape_file_names): Add, and
+ run escape_file_names.pl on all files in output directory.
+
+ This reduces the number of files with non-ASCII file namess
+ in the sources which can cause problems on some unusual platforms.
+ Report from Eli.
+
2024-11-14 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/convert_html.c (html_do_js_files): set
diff --git a/tp/Texinfo/XS/XSParagraph.xs b/tp/Texinfo/XS/XSParagraph.xs
index 5a37cb9232..f5f13f840e 100644
--- a/tp/Texinfo/XS/XSParagraph.xs
+++ b/tp/Texinfo/XS/XSParagraph.xs
@@ -36,10 +36,12 @@ xspara_new (class, ...)
PREINIT:
HV *conf = 0;
int id;
- SV **val;
-#define FETCH(key) hv_fetch (conf, key, strlen (key), 0)
-#define xspara_SET_CONF(variable) { val = FETCH(#variable); \
- if (val) { xspara_set_conf_##variable (SvIV (*val)); } }
+#define xspara_SET_CONF(variable) \
+ else if (!strcmp (var_name, #variable)) \
+ { \
+ if (SvOK (value_sv)) \
+ {xspara_set_conf_##variable (SvIV (value_sv));} \
+ }
CODE:
items--;
if (items > 0)
@@ -51,7 +53,23 @@ xspara_new (class, ...)
if (conf)
{
- XSPARA_CONF_VARIABLES_LIST
+ I32 hv_number;
+ I32 i;
+
+ hv_number = hv_iterinit (conf);
+
+ for (i = 0; i < hv_number; i++)
+ {
+ I32 retlen;
+ char *var_name;
+ SV *value_sv = hv_iternextsv (conf, &var_name, &retlen);
+
+ if (0)
+ {}
+ /* XSPARA_CONF_VARIABLES_LIST is replaced by xspara_SET_CONF(variable)
+ for each of the configuration variables */
+ XSPARA_CONF_VARIABLES_LIST
+ }
}
/* Create an integer, which the other functions
@@ -61,7 +79,6 @@ xspara_new (class, ...)
RETVAL
CLEANUP:
#undef xspara_SET_CONF
-#undef FETCH
int