Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit readline: fix lint warning about effective uncon...



details:   https://anonhg.NetBSD.org/src/rev/27dc7874da33
branches:  trunk
changeset: 1022958:27dc7874da33
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 15 22:14:45 2021 +0000

description:
readline: fix lint warning about effective unconst cast

Calling strchr to avoid the syntactical unconst cast is not necessary
here.  A simple pointer assignment is enough.

No functional change.

diffstat:

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

diffs (32 lines):

diff -r d00f8327eead -r 27dc7874da33 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Sun Aug 15 22:08:01 2021 +0000
+++ b/lib/libedit/readline.c    Sun Aug 15 22:14:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.160 2021/08/15 10:06:32 christos Exp $  */
+/*     $NetBSD: readline.c,v 1.161 2021/08/15 22:14:45 rillig 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.160 2021/08/15 10:06:32 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.161 2021/08/15 22:14:45 rillig Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -208,11 +208,10 @@
 _resize_fun(EditLine *el, void *a)
 {
        const LineInfo *li;
-       char **ap = a;
+       const char **ap = a;
 
        li = el_line(el);
-       /* a cheesy way to get rid of const cast. */
-       *ap = memchr(li->buffer, *li->buffer, (size_t)1);
+       *ap = li->buffer;
 }
 
 static const char *



Home | Main Index | Thread Index | Old Index