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/api_to_perl.c (register_perl


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/main/api_to_perl.c (register_perl_data): add register_perl_data and call it or unregister_perl_data, inlining register_perl_buttons_list, unregister_perl_buttons_list, unregister_perl_button, register_perl_button, unregister_perl_direction_icons.
Date: Wed, 02 Oct 2024 17:04:55 -0400

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 772d8fa088 * tp/Texinfo/XS/main/api_to_perl.c (register_perl_data): 
add register_perl_data and call it or unregister_perl_data, inlining 
register_perl_buttons_list, unregister_perl_buttons_list, 
unregister_perl_button, register_perl_button, unregister_perl_direction_icons.
772d8fa088 is described below

commit 772d8fa088cfb96f51b8f5cb07487a06b29fcdc9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 4 10:40:17 2024 +0200

    * tp/Texinfo/XS/main/api_to_perl.c (register_perl_data): add
    register_perl_data and call it or unregister_perl_data, inlining
    register_perl_buttons_list, unregister_perl_buttons_list,
    unregister_perl_button, register_perl_button,
    unregister_perl_direction_icons.
---
 ChangeLog                                       |  8 ++++
 tp/Texinfo/XS/convert/get_converter_perl_info.c |  3 ++
 tp/Texinfo/XS/main/api_to_perl.c                | 60 ++++++-------------------
 tp/Texinfo/XS/main/api_to_perl.h                |  6 +--
 tp/Texinfo/XS/main/get_perl_info.c              |  1 +
 tp/Texinfo/XS/main/utils.c                      | 15 ++++---
 6 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 82e9cc6421..b4db2410a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-08-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/main/api_to_perl.c (register_perl_data): add
+       register_perl_data and call it or unregister_perl_data, inlining
+       register_perl_buttons_list, unregister_perl_buttons_list,
+       unregister_perl_button, register_perl_button,
+       unregister_perl_direction_icons.
+
 2024-08-04  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/converter.c
diff --git a/tp/Texinfo/XS/convert/get_converter_perl_info.c 
b/tp/Texinfo/XS/convert/get_converter_perl_info.c
index ba0de03eb2..085e9794e8 100644
--- a/tp/Texinfo/XS/convert/get_converter_perl_info.c
+++ b/tp/Texinfo/XS/convert/get_converter_perl_info.c
@@ -227,6 +227,8 @@ get_converter_info_from_sv (SV *conf_sv, CONVERTER 
*converter,
   return 0;
 }
 
+/* add to converter hash the INIT_INFO_SV key values that are
+   not customization variables, listed in NO_VALID_CUSTOMIZATION */
 static void
 set_non_customization_sv (HV *converter_hv, SV *init_info_sv,
                           STRING_LIST *non_valid_customization)
@@ -276,6 +278,7 @@ converter_get_info_from_sv (SV *converter_sv, CONVERTER 
*converter,
   has_conf = get_converter_info_from_sv (conf_sv, converter,
                                converter->sorted_options, conf);
 
+  /* set directly Perl converter keys with non 'valid' customization info */
   set_non_customization_sv (converter_hv, format_defaults_sv,
                             &format_defaults->non_valid_customization);
 
diff --git a/tp/Texinfo/XS/main/api_to_perl.c b/tp/Texinfo/XS/main/api_to_perl.c
index fd2887973a..2f07a6da48 100644
--- a/tp/Texinfo/XS/main/api_to_perl.c
+++ b/tp/Texinfo/XS/main/api_to_perl.c
@@ -62,53 +62,18 @@ unregister_perl_tree_element (ELEMENT *e)
 }
 
 void
-unregister_perl_buttons_list (BUTTON_SPECIFICATION_LIST *buttons_list)
+unregister_perl_data (void *sv)
 {
   dTHX;
 
-  if (buttons_list->av)
-    SvREFCNT_dec (buttons_list->av);
+  SvREFCNT_dec (sv);
 }
 
 void
-register_perl_buttons_list (BUTTON_SPECIFICATION_LIST *buttons_list)
-{
-  dTHX;
-
-  if (buttons_list->av)
-    SvREFCNT_inc (buttons_list->av);
-}
-
-void
-unregister_perl_button (BUTTON_SPECIFICATION *button)
-{
-  dTHX;
-
-  if (button->sv)
-    SvREFCNT_dec (button->sv);
-}
-
-void
-register_perl_button (BUTTON_SPECIFICATION *button)
-{
-  dTHX;
-
-  if (button->sv)
-    SvREFCNT_inc (button->sv);
-}
-
-void
-unregister_perl_direction_icons (DIRECTION_ICON_LIST *direction_icons)
+register_perl_data (void *sv)
 {
   dTHX;
 
-  if (direction_icons->sv)
-    SvREFCNT_dec (direction_icons->sv);
-}
-
-void
-register_perl_data (void *sv)
-{
   SvREFCNT_inc (sv);
 }
 
@@ -161,27 +126,28 @@ croak_message (char *message)
   croak ("%s\n", message);
 }
 
-/* HTML specific */
 void
-unregister_html_converter_perl_hv (CONVERTER *converter)
+unregister_document_hv (DOCUMENT *document)
 {
   dTHX;
 
-  if (converter->pl_info_hv)
+  if (document->hv)
     {
-      SvREFCNT_dec ((SV *)converter->pl_info_hv);
-      converter->pl_info_hv = 0;
+      SvREFCNT_dec ((SV *)document->hv);
+      document->hv = 0;
     }
 }
 
+/* HTML specific */
 void
-unregister_document_hv (DOCUMENT *document)
+unregister_html_converter_perl_hv (CONVERTER *converter)
 {
   dTHX;
 
-  if (document->hv)
+  if (converter->pl_info_hv)
     {
-      SvREFCNT_dec ((SV *)document->hv);
-      document->hv = 0;
+      SvREFCNT_dec ((SV *)converter->pl_info_hv);
+      converter->pl_info_hv = 0;
     }
 }
+
diff --git a/tp/Texinfo/XS/main/api_to_perl.h b/tp/Texinfo/XS/main/api_to_perl.h
index 8ddbaf44bb..f13670ec26 100644
--- a/tp/Texinfo/XS/main/api_to_perl.h
+++ b/tp/Texinfo/XS/main/api_to_perl.h
@@ -8,12 +8,8 @@
 int get_refcount (void *sv);
 
 void unregister_perl_tree_element (ELEMENT *e);
-void unregister_perl_buttons_list (BUTTON_SPECIFICATION_LIST *buttons_list);
-void register_perl_buttons_list (BUTTON_SPECIFICATION_LIST *buttons_list);
-void unregister_perl_button (BUTTON_SPECIFICATION *button);
-void register_perl_button (BUTTON_SPECIFICATION *button);
-void unregister_perl_direction_icons (DIRECTION_ICON_LIST *direction_icons);
 void unregister_document_hv (DOCUMENT *document);
+void unregister_perl_data (void *sv);
 void register_perl_data (void *sv);
 /* HTML specific */
 void unregister_html_converter_perl_hv (CONVERTER *converter);
diff --git a/tp/Texinfo/XS/main/get_perl_info.c 
b/tp/Texinfo/XS/main/get_perl_info.c
index b5b6670467..3664370158 100644
--- a/tp/Texinfo/XS/main/get_perl_info.c
+++ b/tp/Texinfo/XS/main/get_perl_info.c
@@ -514,6 +514,7 @@ get_sv_options (SV *sv, OPTIONS *options, OPTION 
**sorted_options,
     }
 }
 
+/* pass sorted options to SORTED_OPTIONS_OUT, if set */
 OPTIONS *
 init_copy_sv_options (SV *sv_in, CONVERTER *converter, int force,
                       OPTION ***sorted_options_out)
diff --git a/tp/Texinfo/XS/main/utils.c b/tp/Texinfo/XS/main/utils.c
index 41fc8291d2..0296d89866 100644
--- a/tp/Texinfo/XS/main/utils.c
+++ b/tp/Texinfo/XS/main/utils.c
@@ -1635,11 +1635,13 @@ html_free_button_specification_list 
(BUTTON_SPECIFICATION_LIST *buttons)
             }
           else if (button->type == BST_string)
             free (button->b.string);
-          unregister_perl_button (button);
+          if (button->sv)
+            unregister_perl_data (button->sv);
         }
     }
   free (buttons->list);
-  unregister_perl_buttons_list (buttons);
+  if (buttons->av)
+    unregister_perl_data (buttons->av);
   free (buttons);
 }
 
@@ -1669,7 +1671,8 @@ html_free_direction_icons (DIRECTION_ICON_LIST 
*direction_icons)
   free (direction_icons->list);
   direction_icons->number = 0;
   direction_icons->list = 0;
-  unregister_perl_direction_icons (direction_icons);
+  if (direction_icons->sv)
+    unregister_perl_data (direction_icons->sv);
 }
 
 /* here because it is used in main/get_perl_info.c */
@@ -1921,7 +1924,8 @@ copy_option (OPTION *destination, const OPTION *source)
               result->number = s_buttons->number;
 
               result->av = s_buttons->av;
-              register_perl_buttons_list (result);
+              if (result->av)
+                register_perl_data (result->av);
 
               result->list = (BUTTON_SPECIFICATION *)
                  malloc (result->number * sizeof (BUTTON_SPECIFICATION));
@@ -1935,7 +1939,8 @@ copy_option (OPTION *destination, const OPTION *source)
                   button->sv = s_button->sv;
                   /* need to increase the counter, as it is decreased upon
                      destroying the button */
-                  register_perl_button (button);
+                  if (button->sv)
+                    register_perl_data (button->sv);
                   button->type = s_button->type;
                   if (button->type == BST_function)
                     button->b.sv_reference = s_button->b.sv_reference;



reply via email to

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