texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Gavin D. Smith
Date: Sun, 11 Feb 2024 07:47:31 -0500 (EST)

branch: master
commit 52b75956e1866988659647ba4e199f2ed47d9188
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun Feb 11 12:11:06 2024 +0000

    * info/variables.c (set_variable): Split out code getting the
    default value of a variable so it is easier to read, not using
    the ternary conditional operator.  No functional change.
---
 ChangeLog        |  6 ++++++
 info/variables.c | 15 ++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cf5e21aa1f..b56f64e74c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-02-11  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * info/variables.c (set_variable): Split out code getting the
+       default value of a variable so it is easier to read, not using
+       the ternary conditional operator.  No functional change.
+
 2024-02-11  Gavin Smith <gavinsmith0123@gmail.com>
 
        Avoid crash from undefined style.
diff --git a/info/variables.c b/info/variables.c
index 7dad812e6b..3b270d871b 100644
--- a/info/variables.c
+++ b/info/variables.c
@@ -301,13 +301,14 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of 
an Info variable"))
           add_pointer_to_array (entry, array_index, array, array_slots, 10);
         }
 
-      sprintf (prompt, _("Set %s to value (%s): "),
-               var->name,
-               var->value == &highlight_searches
-               ? on_off_choices[match_rendition.mask != 0]
-               : var->choices == (char **) &rendition_choices
-               ? rendition_to_string (var->value)
-               : var->choices[*(int *)(var->value)]);
+      char *current_value = var->choices[*(int *)(var->value)];
+
+      if (var->value == &highlight_searches)
+        current_value = on_off_choices[match_rendition.mask != 0];
+      else if (var->choices == (char **) &rendition_choices)
+        current_value = rendition_to_string (var->value);
+
+      sprintf (prompt, _("Set %s to value (%s): "), var->name, current_value);
 
       /* Ask the completer to read a variable value for us. */
       if (var->choices == (char **) &rendition_choices)



reply via email to

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