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/8548c672e152
branches:  trunk
changeset: 450609:8548c672e152
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 3fab8bc79dbf -r 8548c672e152 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