[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/parsetexi/macro.c (new_macro): in
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/parsetexi/macro.c (new_macro): inline lookup_free_slot in new_macro. |
Date: |
Mon, 20 May 2024 17:59:24 -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 cf498de18e * tp/Texinfo/XS/parsetexi/macro.c (new_macro): inline
lookup_free_slot in new_macro.
cf498de18e is described below
commit cf498de18e3e17f47f27c554c89e9637b96a546c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon May 20 23:59:12 2024 +0200
* tp/Texinfo/XS/parsetexi/macro.c (new_macro): inline lookup_free_slot
in new_macro.
---
ChangeLog | 5 +++++
tp/Texinfo/XS/parsetexi/macro.c | 26 +++++---------------------
2 files changed, 10 insertions(+), 21 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 71d51f522d..01735dafce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-05-20 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/parsetexi/macro.c (new_macro): inline lookup_free_slot
+ in new_macro.
+
2024-05-20 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/parsetexi/macro.c (free_slots_nr, lookup_free_slot)
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 133ef18b34..56436cfb56 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -61,20 +61,6 @@ lookup_macro (enum command_id cmd)
return 0;
}
-/* return 0 if not found, index +1 if found */
-static size_t
-lookup_free_slot ()
-{
- size_t i;
-
- for (i = 0; i < macro_number; i++)
- {
- if (macro_list[i].cmd == 0)
- return i+1;
- }
- return 0;
-}
-
void
new_macro (const char *name, const ELEMENT *macro)
{
@@ -94,14 +80,12 @@ new_macro (const char *name, const ELEMENT *macro)
size_t macro_index;
if (free_slots_nr)
{
- size_t free_slot = lookup_free_slot ();
- if (free_slot)
- {
- macro_index = free_slot - 1;
- free_slots_nr--;
- }
- else
+ for (macro_index = 0; macro_index < macro_number; macro_index++)
+ if (macro_list[macro_index].cmd == 0)
+ break;
+ if (macro_index == macro_number)
bug ("free slot not found");
+ free_slots_nr--;
}
else
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/parsetexi/macro.c (new_macro): inline lookup_free_slot in new_macro.,
Patrice Dumas <=