Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit fix logic (Ingo Schwarze)



details:   https://anonhg.NetBSD.org/src/rev/a5bf0e84c625
branches:  trunk
changeset: 345084:a5bf0e84c625
user:      christos <christos%NetBSD.org@localhost>
date:      Fri May 06 21:01:19 2016 +0000

description:
fix logic (Ingo Schwarze)

diffstat:

 lib/libedit/readline.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 58a95c8b4fd0 -r a5bf0e84c625 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Fri May 06 20:12:54 2016 +0000
+++ b/lib/libedit/readline.c    Fri May 06 21:01:19 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.128 2016/04/18 17:01:19 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.129 2016/05/06 21:01:19 christos Exp $  */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.128 2016/04/18 17:01:19 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.129 2016/05/06 21:01:19 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -1592,7 +1592,7 @@
        int curr_num;
 
        if (pos >= history_length || pos < 0)
-               return -1;
+               return 0;
 
        (void)history(h, &ev, H_CURR);
        curr_num = ev.num;
@@ -1603,9 +1603,9 @@
         */
        if (history(h, &ev, H_DELDATA, pos, (void **)-1)) {
                (void)history(h, &ev, H_SET, curr_num);
-               return -1;
+               return 0;
        }
-       return 0;
+       return 1;
 }
 
 
@@ -1688,7 +1688,7 @@
                return -1;
        curr_num = ev.num;
 
-       if (history_set_pos(off) != 0 || history(h, &ev, H_CURR) != 0)
+       if (!history_set_pos(off) || history(h, &ev, H_CURR) != 0)
                return -1;
 
        for (;;) {



Home | Main Index | Thread Index | Old Index