texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/XS/main/customization_options.c (opt


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/customization_options.c (option_number_in_option_list, options_list_add_option_number), maintain/regenerate_C_options_info.pl: set OF_set_in_list flag in in option flag when the option is added to an option list. Always check that the OF_set_in_list flag is not set before adding to the options list, and remove the check_duplicates options_list_add_option_number argument. Update callers.
Date: Mon, 23 Dec 2024 18:16:21 -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 f5d6634802 * tp/Texinfo/XS/main/customization_options.c 
(option_number_in_option_list, options_list_add_option_number), 
maintain/regenerate_C_options_info.pl: set OF_set_in_list flag in in option 
flag when the option is added to an option list.  Always check that the 
OF_set_in_list flag is not set before adding to the options list, and remove 
the check_duplicates options_list_add_option_number argument.  Update callers.
f5d6634802 is described below

commit f5d66348023c6779a3cb3c767fe37008de4be3e4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Dec 17 18:52:10 2024 +0100

    * tp/Texinfo/XS/main/customization_options.c
    (option_number_in_option_list, options_list_add_option_number),
    maintain/regenerate_C_options_info.pl: set OF_set_in_list flag in in
    option flag when the option is added to an option list.  Always check
    that the OF_set_in_list flag is not set before adding to the options
    list, and remove the check_duplicates options_list_add_option_number
    argument.  Update callers.
---
 ChangeLog                                       | 10 +++++++
 tp/Texinfo/XS/convert/converter.c               |  2 +-
 tp/Texinfo/XS/convert/get_converter_perl_info.c |  5 +---
 tp/Texinfo/XS/convert/texinfo.c                 |  4 +--
 tp/Texinfo/XS/main/customization_options.c      | 35 +++++++++----------------
 tp/Texinfo/XS/main/customization_options.h      |  4 +--
 tp/Texinfo/XS/main/option_types.h               |  1 +
 tp/Texinfo/XS/main/options_defaults.c           | 32 +++++++++++-----------
 tp/Texinfo/XS/teximakehtml.c                    | 12 ++++-----
 tp/maintain/regenerate_C_options_info.pl        |  2 +-
 10 files changed, 53 insertions(+), 54 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 11f046c738..a150222d53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-12-17  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/customization_options.c
+       (option_number_in_option_list, options_list_add_option_number),
+       maintain/regenerate_C_options_info.pl: set OF_set_in_list flag in in
+       option flag when the option is added to an option list.  Always check
+       that the OF_set_in_list flag is not set before adding to the options
+       list, and remove the check_duplicates options_list_add_option_number
+       argument.  Update callers.
+
 2024-12-15  Patrice Dumas  <pertusus@free.fr>
 
        Use XDG base directory in teximakehtml
diff --git a/tp/Texinfo/XS/convert/converter.c 
b/tp/Texinfo/XS/convert/converter.c
index b17133cfbf..55b39fab22 100644
--- a/tp/Texinfo/XS/convert/converter.c
+++ b/tp/Texinfo/XS/convert/converter.c
@@ -428,7 +428,7 @@ copy_converter_initialization_info 
(CONVERTER_INITIALIZATION_INFO *dst_info,
   copy_strings (&dst_info->non_valid_customization,
                 &src_info->non_valid_customization);
 
-  copy_options_list (&dst_info->conf, &src_info->conf, 1);
+  copy_options_list (&dst_info->conf, &src_info->conf);
 
   if (src_info->translated_commands)
     {
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c 
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index 41faf3c790..cb406125c2 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -285,12 +285,9 @@ get_converter_info_from_sv (SV *conf_sv, const char 
*class_name,
               int status = get_sv_option (option, value_sv, 0,
                                       initialization_info->conf.options,
                                       converter);
-              /* Since the key cannot be duplicated, there is no need
-                 to check if the option->number is already in the
-                 initialization_info->conf list */
               if (!status)
                 options_list_add_option_number (&initialization_info->conf,
-                                                option->number, 0);
+                                                option->number);
               else
                /* can only be an error of bad data value_sv, as the options
                   cannot be set already */
diff --git a/tp/Texinfo/XS/convert/texinfo.c b/tp/Texinfo/XS/convert/texinfo.c
index 3a752c87fd..f192c66e0a 100644
--- a/tp/Texinfo/XS/convert/texinfo.c
+++ b/tp/Texinfo/XS/convert/texinfo.c
@@ -161,7 +161,7 @@ txi_converter_format_defaults (const char *format_str,
   CONVERTER_INITIALIZATION_INFO *format_defaults;
 
   if (customizations)
-    copy_options_list (&conf->conf, customizations, 0);
+    copy_options_list (&conf->conf, customizations);
 
   format_defaults = converter_defaults (converter_format, conf);
 
@@ -421,7 +421,7 @@ txi_converter_setup (const char *format_str,
 
   if (customizations)
     {
-      copy_options_list (&conf->conf, customizations, 1);
+      copy_options_list (&conf->conf, customizations);
     }
 
   if (conf->conf.options->TEST.o.integer <= 0
diff --git a/tp/Texinfo/XS/main/customization_options.c 
b/tp/Texinfo/XS/main/customization_options.c
index e89d3e49e1..ff0f93078c 100644
--- a/tp/Texinfo/XS/main/customization_options.c
+++ b/tp/Texinfo/XS/main/customization_options.c
@@ -430,26 +430,18 @@ free_options_list (OPTIONS_LIST *options_list)
 int
 option_number_in_option_list (OPTIONS_LIST *options_list, size_t number)
 {
-  size_t i;
-
-  for (i = 0; i < options_list->number; i++)
-    {
-      size_t option_nr = options_list->list[i];
-      if (number == option_nr)
-        return 1;
-    }
-  return 0;
+  if (options_list->sorted_options[number -1]->flags & OF_set_in_list)
+    return 1;
+  else
+    return 0;
 }
 
 void
 options_list_add_option_number (OPTIONS_LIST *options_list,
-                                size_t number, int check_duplicates)
+                                size_t number)
 {
-  if (check_duplicates)
-    {
-      if (option_number_in_option_list (options_list, number))
-        return;
-    }
+  if (options_list->sorted_options[number -1]->flags & OF_set_in_list)
+    return;
 
   if (options_list->number >= options_list->space)
     {
@@ -457,6 +449,7 @@ options_list_add_option_number (OPTIONS_LIST *options_list,
              (options_list->space += 5) * sizeof (size_t));
     }
   options_list->list[options_list->number] = number;
+  options_list->sorted_options[number -1]->flags |= OF_set_in_list;
   options_list->number++;
 }
 
@@ -469,7 +462,7 @@ options_list_add_option_name (OPTIONS_LIST *options_list,
   if (!option)
     return 0;
 
-  options_list_add_option_number (options_list, option->number, 1);
+  options_list_add_option_number (options_list, option->number);
 
   return option;
 }
@@ -504,8 +497,7 @@ copy_options_list_options (OPTIONS *options, OPTION 
**sorted_options,
 }
 
 void
-copy_options_list (OPTIONS_LIST *options_list, const OPTIONS_LIST *options_src,
-                   int check_duplicates)
+copy_options_list (OPTIONS_LIST *options_list, const OPTIONS_LIST *options_src)
 {
   copy_options_list_options (options_list->options,
                              options_list->sorted_options,
@@ -514,8 +506,7 @@ copy_options_list (OPTIONS_LIST *options_list, const 
OPTIONS_LIST *options_src,
     {
       size_t i;
       for (i = 0; i < options_src->number; i++)
-        options_list_add_option_number (options_list, options_src->list[i],
-                                        check_duplicates);
+        options_list_add_option_number (options_list, options_src->list[i]);
     }
 }
 
@@ -559,7 +550,7 @@ add_new_button_option (OPTIONS_LIST *options_list, const 
char *option_name,
   if (!option || option->type != GOT_buttons)
     return 0;
 
-  options_list_add_option_number (options_list, option->number, 1);
+  options_list_add_option_number (options_list, option->number);
 
   if (option->o.buttons)
     options_list->options->BIT_user_function_number
@@ -588,7 +579,7 @@ add_option_strlist_value (OPTIONS_LIST *options_list,
       && option->type != GOT_file_string_list)
     return 0;
 
-  options_list_add_option_number (options_list, option->number, 1);
+  options_list_add_option_number (options_list, option->number);
 
   clear_option (option);
 
diff --git a/tp/Texinfo/XS/main/customization_options.h 
b/tp/Texinfo/XS/main/customization_options.h
index afe462d0c4..e20b681392 100644
--- a/tp/Texinfo/XS/main/customization_options.h
+++ b/tp/Texinfo/XS/main/customization_options.h
@@ -60,9 +60,9 @@ void initialize_options_list (OPTIONS_LIST *options_list);
 void free_options_list (OPTIONS_LIST *options_list);
 int option_number_in_option_list (OPTIONS_LIST *options_list, size_t number);
 void options_list_add_option_number (OPTIONS_LIST *options_list,
-                                     size_t number, int check_duplicates);
+                                     size_t number);
 void copy_options_list (OPTIONS_LIST *options_list,
-                        const OPTIONS_LIST *options_src, int check_duplicates);
+                        const OPTIONS_LIST *options_src);
 void copy_options_list_set_configured (OPTIONS *options,
                                        OPTION **sorted_options,
                                        const OPTIONS_LIST *options_list,
diff --git a/tp/Texinfo/XS/main/option_types.h 
b/tp/Texinfo/XS/main/option_types.h
index 4e6035bb40..e099537104 100644
--- a/tp/Texinfo/XS/main/option_types.h
+++ b/tp/Texinfo/XS/main/option_types.h
@@ -171,6 +171,7 @@ typedef struct DIRECTION_ICON_LIST {
 
 #define OF_configured          0x0001
 #define OF_parser_option       0x0002
+#define OF_set_in_list         0x0004
 
 typedef struct OPTION {
     enum global_option_type type;
diff --git a/tp/Texinfo/XS/main/options_defaults.c 
b/tp/Texinfo/XS/main/options_defaults.c
index 8a0947b791..bcda5e9ef7 100644
--- a/tp/Texinfo/XS/main/options_defaults.c
+++ b/tp/Texinfo/XS/main/options_defaults.c
@@ -26,19 +26,19 @@ add_array_cmdline_options_defaults (OPTIONS_LIST 
*options_list)
   OPTION *option;
 
   option = find_option_string (options_list->sorted_options, "CSS_FILES");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, "CSS_REFS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"EXPANDED_FORMATS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"INCLUDE_DIRECTORIES");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"TEXINFO_LANGUAGE_DIRECTORIES");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
 }
 
@@ -397,37 +397,37 @@ add_converter_other_options_defaults (OPTIONS_LIST 
*options_list)
   OPTION *option;
 
   option = find_option_string (options_list->sorted_options, "LINKS_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, "TOP_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"TOP_FOOTER_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"SECTION_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"CHAPTER_FOOTER_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"SECTION_FOOTER_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"NODE_FOOTER_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, "MISC_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, 
"CHAPTER_BUTTONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, "ACTIVE_ICONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
   option = find_option_string (options_list->sorted_options, "PASSIVE_ICONS");
-  options_list_add_option_number (options_list, option->number, 0);
+  options_list_add_option_number (options_list, option->number);
   clear_option (option);
 }
 
diff --git a/tp/Texinfo/XS/teximakehtml.c b/tp/Texinfo/XS/teximakehtml.c
index 921bac8c42..f5a8f047ed 100644
--- a/tp/Texinfo/XS/teximakehtml.c
+++ b/tp/Texinfo/XS/teximakehtml.c
@@ -110,7 +110,7 @@ set_customization_default (const OPTION *option)
   if (option_number_in_option_list (&cmdline_options, option->number))
     return 0;
 
-  options_list_add_option_number (&program_options, option->number, 1);
+  options_list_add_option_number (&program_options, option->number);
   copy_option (program_options.sorted_options[option->number -1], option);
   return 1;
 }
@@ -378,7 +378,7 @@ get_cmdline_customization_option (OPTIONS_LIST 
*options_list,
               option_set_conf (option, 0, value);
               free (value);
             }
-          options_list_add_option_number (options_list, option->number, 1);
+          options_list_add_option_number (options_list, option->number);
         }
       else
         {
@@ -560,7 +560,7 @@ main (int argc, char *argv[])
     {
       OPTION *option = &cmdline_options.options->INCLUDE_DIRECTORIES;
       options_list_add_option_number (&cmdline_options,
-                                      option->number, 0);
+                                      option->number);
       merge_strings (option->o.strlist, &include_dirs);
       include_dirs.number = 0;
     }
@@ -626,7 +626,7 @@ main (int argc, char *argv[])
           if (option)
             {
               options_list_add_option_number (&parser_options,
-                                              parser_option->number, 0);
+                                              parser_option->number);
               copy_option (parser_option, option);
             }
         }
@@ -695,8 +695,8 @@ main (int argc, char *argv[])
 
   /* conversion initialization */
   initialize_options_list (&convert_options);
-  copy_options_list (&convert_options, &program_options, 0);
-  copy_options_list (&convert_options, &cmdline_options, 1);
+  copy_options_list (&convert_options, &program_options);
+  copy_options_list (&convert_options, &cmdline_options);
 
   if (run_mode == TEXIMAKEHTML_mode_demo)
     {
diff --git a/tp/maintain/regenerate_C_options_info.pl 
b/tp/maintain/regenerate_C_options_info.pl
index c86863fa20..7c331e2dbc 100755
--- a/tp/maintain/regenerate_C_options_info.pl
+++ b/tp/maintain/regenerate_C_options_info.pl
@@ -449,7 +449,7 @@ foreach my $category (sort(keys(%option_categories))) {
         "  option = find_option_string (options_list->sorted_options, "
                                                  ."\"$option\");\n";
       print ODCF
-        "  options_list_add_option_number (options_list, option->number, 
0);\n";
+        "  options_list_add_option_number (options_list, option->number);\n";
       print ODCF "  clear_option (option);\n";
     }
   }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]