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/e573fa3e5481
branches:  trunk
changeset: 455955:e573fa3e5481
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 d7be710ee03f -r e573fa3e5481 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