texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/api.c (build_single_ind


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/api.c (build_single_index_data): Remove commented-out code. Combine conditional blocks. Use av_unshift and av_store instead of av_push.
Date: Mon, 10 Apr 2023 13:28:40 -0400

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new f409ae3c38 * tp/Texinfo/XS/parsetexi/api.c (build_single_index_data): 
Remove commented-out code.  Combine conditional blocks.  Use av_unshift and 
av_store instead of av_push.
f409ae3c38 is described below

commit f409ae3c38c8ecc62fc45066d076d75978659726
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Apr 10 18:28:32 2023 +0100

    * tp/Texinfo/XS/parsetexi/api.c (build_single_index_data):
    Remove commented-out code.  Combine conditional blocks.  Use
    av_unshift and av_store instead of av_push.
---
 ChangeLog                     |  6 +++++
 tp/Texinfo/XS/parsetexi/api.c | 53 ++++++++++++-------------------------------
 2 files changed, 21 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c6b929765a..b5c32a3a2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-04-10  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/XS/parsetexi/api.c (build_single_index_data):
+       Remove commented-out code.  Combine conditional blocks.  Use
+       av_unshift and av_store instead of av_push.
+
 2023-04-10  Gavin Smith <gavinsmith0123@gmail.com>
 
        Run 'gnulib-tool --add-import obstack' under tp/Texinfo/XS.
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index 3945a558f3..12362a1e5c 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -823,53 +823,30 @@ build_single_index_data (INDEX *i)
   if (i->index_number > 0)
     {
       entries = newAV ();
+      av_unshift (entries, i->index_number);
       STORE("index_entries", newRV_inc ((SV *) entries));
-    }
 #undef STORE
 
-  entry_number = 1;
-  if (i->index_number > 0)
-  for (j = 0; j < i->index_number; j++)
-    {
+      entry_number = 1;
+      for (j = 0; j < i->index_number; j++)
+        {
 #define STORE2(key, value) hv_store (entry, key, strlen (key), value, 0)
-      HV *entry;
-      INDEX_ENTRY *e;
+          HV *entry;
+          INDEX_ENTRY *e;
 
-      e = &i->index_entries[j];
-      entry = newHV ();
+          e = &i->index_entries[j];
+          entry = newHV ();
 
-      STORE2("index_name", newSVpv_utf8 (i->name, 0));
-      STORE2("entry_element",
-             newRV_inc ((SV *)e->command->hv));
-      STORE2("entry_number", newSViv (entry_number));
+          STORE2("index_name", newSVpv_utf8 (i->name, 0));
+          STORE2("entry_element",
+                 newRV_inc ((SV *)e->command->hv));
+          STORE2("entry_number", newSViv (entry_number));
 
-      av_push (entries, newRV_inc ((SV *)entry));
+          av_store (entries, j, newRV_inc ((SV *)entry));
 
-      /*
-      {
-      SV **extra_hash;
-      AV *av;
-      extra_hash = hv_fetch (e->command->hv, "extra", strlen ("extra"), 0);
-      if (!extra_hash)
-        {*/
-          /* There's no guarantee that the "extra" value was set on
-             the element. */
-        /*
-          extra_hash = hv_store (e->command->hv, "extra", strlen ("extra"),
-                                 newRV_inc ((SV *)newHV ()), 0);
-        }*/
-
-      /* element index_entry extra value is an array reference containing the
-         index name and entry number */
-      /*
-      av = newAV ();
-      av_push (av, newSVpv_utf8 (i->name, 0));
-      av_push (av, newSViv (entry_number));
-      hv_store ((HV *)SvRV(*extra_hash), "index_entry", strlen ("index_entry"),
-                newRV_inc ((SV *)av), 0);
-      }*/
-      entry_number++;
+          entry_number++;
 #undef STORE2
+        }
     }
 }
 



reply via email to

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