Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit PR lib/54131 - declare the loop variable outside...



details:   https://anonhg.NetBSD.org/src/rev/8fd551ef3fee
branches:  trunk
changeset: 998451:8fd551ef3fee
user:      abhinav <abhinav%NetBSD.org@localhost>
date:      Sat Apr 20 08:44:10 2019 +0000

description:
PR lib/54131 - declare the loop variable outside the for loop

diffstat:

 lib/libedit/filecomplete.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 9683730578e5 -r 8fd551ef3fee lib/libedit/filecomplete.c
--- a/lib/libedit/filecomplete.c        Sat Apr 20 07:27:39 2019 +0000
+++ b/lib/libedit/filecomplete.c        Sat Apr 20 08:44:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecomplete.c,v 1.54 2019/04/12 15:12:29 christos Exp $       */
+/*     $NetBSD: filecomplete.c,v 1.55 2019/04/20 08:44:10 abhinav Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.54 2019/04/12 15:12:29 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.55 2019/04/20 08:44:10 abhinav Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -177,11 +177,12 @@
 static wchar_t *
 unescape_string(const wchar_t *string, size_t length)
 {
+       size_t i;
+       size_t j = 0;
        wchar_t *unescaped = el_malloc(sizeof(*string) * (length + 1));
        if (unescaped == NULL)
                return NULL;
-       size_t j = 0;
-       for (size_t i = 0; i < length ; i++) {
+       for (i = 0; i < length ; i++) {
                if (string[i] == '\\')
                        continue;
                unescaped[j++] = string[i];



Home | Main Index | Thread Index | Old Index