Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit Follow the man page for EL_GETTC and not require...



details:   https://anonhg.NetBSD.org/src/rev/25de3b6690bd
branches:  trunk
changeset: 450814:25de3b6690bd
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 26 16:56:57 2019 +0000

description:
Follow the man page for EL_GETTC and not require a NULL terminated argument
list: https://reviews.llvm.org/D61191

diffstat:

 lib/libedit/el.c       |  16 ++++++----------
 lib/libedit/eln.c      |  14 ++++++--------
 lib/libedit/readline.c |   8 ++++----
 3 files changed, 16 insertions(+), 22 deletions(-)

diffs (105 lines):

diff -r 85287ce13bfe -r 25de3b6690bd lib/libedit/el.c
--- a/lib/libedit/el.c  Fri Apr 26 14:58:56 2019 +0000
+++ b/lib/libedit/el.c  Fri Apr 26 16:56:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: el.c,v 1.97 2018/11/18 17:09:39 christos Exp $ */
+/*     $NetBSD: el.c,v 1.98 2019/04/26 16:56:57 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)el.c       8.2 (Berkeley) 1/3/94";
 #else
-__RCSID("$NetBSD: el.c,v 1.97 2018/11/18 17:09:39 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.98 2019/04/26 16:56:57 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -439,15 +439,11 @@
        case EL_GETTC:
        {
                static char name[] = "gettc";
-               char *argv[20];
-               int i;
-
-               for (i = 1; i < (int)__arraycount(argv); i++)
-                       if ((argv[i] = va_arg(ap, char *)) == NULL)
-                               break;
-
+               char *argv[3];
                argv[0] = name;
-               rv = terminal_gettc(el, i, argv);
+               argv[1] = va_arg(ap, char *);
+               argv[2] = va_arg(ap, void *);
+               rv = terminal_gettc(el, 3, argv);
                break;
        }
 
diff -r 85287ce13bfe -r 25de3b6690bd lib/libedit/eln.c
--- a/lib/libedit/eln.c Fri Apr 26 14:58:56 2019 +0000
+++ b/lib/libedit/eln.c Fri Apr 26 16:56:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eln.c,v 1.34 2016/05/09 21:37:34 christos Exp $        */
+/*     $NetBSD: eln.c,v 1.35 2019/04/26 16:56:57 christos Exp $        */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.34 2016/05/09 21:37:34 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.35 2019/04/26 16:56:57 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <errno.h>
@@ -321,14 +321,12 @@
                break;
 
        case EL_GETTC: {
-               char *argv[20];
+               char *argv[3];
                static char gettc[] = "gettc";
-               int i;
-               for (i = 1; i < (int)__arraycount(argv); ++i)
-                       if ((argv[i] = va_arg(ap, char *)) == NULL)
-                               break;
                argv[0] = gettc;
-               ret = terminal_gettc(el, i, argv);
+               argv[1] = va_arg(ap, char *);
+               argv[2] = va_arg(ap, void *);
+               ret = terminal_gettc(el, 3, argv);
                break;
        }
 
diff -r 85287ce13bfe -r 25de3b6690bd lib/libedit/readline.c
--- a/lib/libedit/readline.c    Fri Apr 26 14:58:56 2019 +0000
+++ b/lib/libedit/readline.c    Fri Apr 26 16:56:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.151 2019/02/15 23:20:35 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.152 2019/04/26 16:56:57 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.151 2019/02/15 23:20:35 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.152 2019/04/26 16:56:57 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -2237,9 +2237,9 @@
 rl_get_screen_size(int *rows, int *cols)
 {
        if (rows)
-               el_get(e, EL_GETTC, "li", rows, (void *)0);
+               el_get(e, EL_GETTC, "li", rows);
        if (cols)
-               el_get(e, EL_GETTC, "co", cols, (void *)0);
+               el_get(e, EL_GETTC, "co", cols);
 }
 
 void



Home | Main Index | Thread Index | Old Index