poke-devel
[Top][All Lists]
Advanced

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

[COMMITTED 2/2] poke/pk-cmd.c: Reduce scope of local variables


From: John Darrington
Subject: [COMMITTED 2/2] poke/pk-cmd.c: Reduce scope of local variables
Date: Sun, 3 May 2020 07:05:07 +0200

---
 ChangeLog     |  4 ++++
 poke/pk-cmd.c | 17 +++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c6b773fe..57c831a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2020-05-03  John Darrington <address@hidden>
+
+       * poke/pk-cmd.c: Reduce scope of local variables.
+
 2020-05-03  John Darrington <address@hidden>
 
        * poke/pk-cmd.c (pk_cmd_get_next_match): Fix bug in completer.
diff --git a/poke/pk-cmd.c b/poke/pk-cmd.c
index 32f2d0df..ae892852 100644
--- a/poke/pk-cmd.c
+++ b/poke/pk-cmd.c
@@ -158,11 +158,9 @@ static void
 pk_trie_expand_cmds (struct pk_trie *root,
                      struct pk_trie *trie)
 {
-  size_t i;
-  struct pk_trie *t;
-
   if (trie->cmd != NULL)
     {
+      struct pk_trie *t;
       t = trie->parent;
       while (t != root && t->num_children == 1)
         {
@@ -171,11 +169,14 @@ pk_trie_expand_cmds (struct pk_trie *root,
         }
     }
   else
-    for (i = 0; i < 256; i++)
-      {
-        if (trie->children[i] != NULL)
-          pk_trie_expand_cmds (root, trie->children[i]);
-      }
+    {
+      size_t i;
+      for (i = 0; i < 256; i++)
+       {
+         if (trie->children[i] != NULL)
+           pk_trie_expand_cmds (root, trie->children[i]);
+       }
+    }
 }
 
 static struct pk_trie *
-- 
2.20.1




reply via email to

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