Module Name:    src
Committed By:   rillig
Date:           Tue Feb  8 21:13:22 UTC 2022

Modified Files:
        src/lib/libedit: chared.c histedit.h

Log Message:
libedit: fix typos, apply KNF to newly imported code (PR/56693)

No binary change.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/lib/libedit/chared.c
cvs rdiff -u -r1.60 -r1.61 src/lib/libedit/histedit.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libedit/chared.c
diff -u src/lib/libedit/chared.c:1.61 src/lib/libedit/chared.c:1.62
--- src/lib/libedit/chared.c:1.61	Tue Feb  8 15:05:10 2022
+++ src/lib/libedit/chared.c	Tue Feb  8 21:13:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: chared.c,v 1.61 2022/02/08 15:05:10 christos Exp $	*/
+/*	$NetBSD: chared.c,v 1.62 2022/02/08 21:13:22 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)chared.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: chared.c,v 1.61 2022/02/08 15:05:10 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.62 2022/02/08 21:13:22 rillig Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -625,29 +625,29 @@ el_deletestr(EditLine *el, int n)
 }
 
 /* el_deletestr1():
- *	Delete characters between starn and end
+ *	Delete characters between start and end
  */
 int
 el_deletestr1(EditLine *el, int start, int end)
 {
-	size_t line_lenght, len;
-	wchar_t * p1, * p2;
+	size_t line_length, len;
+	wchar_t *p1, *p2;
 
 	if (end <= start)
 		return 0;
 
-	line_lenght = (size_t) (el->el_line.lastchar - el->el_line.buffer);
+	line_length = (size_t)(el->el_line.lastchar - el->el_line.buffer);
 
-	if (start >= (int) line_lenght || end >= (int) line_lenght)
+	if (start >= (int)line_length || end >= (int)line_length)
 		return 0;
 
-	len = (size_t) (end - start);
-	if (len > line_lenght - (size_t) end)
-		len = line_lenght - (size_t) end;
+	len = (size_t)(end - start);
+	if (len > line_length - (size_t)end)
+		len = line_length - (size_t)end;
 
 	p1 = el->el_line.buffer + start;
 	p2 = el->el_line.buffer + end;
-	for (size_t i = 0; i < len; i++){
+	for (size_t i = 0; i < len; i++) {
 		*p1++ = *p2++;
 		el->el_line.lastchar--;
 	}

Index: src/lib/libedit/histedit.h
diff -u src/lib/libedit/histedit.h:1.60 src/lib/libedit/histedit.h:1.61
--- src/lib/libedit/histedit.h:1.60	Tue Feb  8 15:05:10 2022
+++ src/lib/libedit/histedit.h	Tue Feb  8 21:13:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.h,v 1.60 2022/02/08 15:05:10 christos Exp $	*/
+/*	$NetBSD: histedit.h,v 1.61 2022/02/08 21:13:22 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -179,8 +179,8 @@ void		 el_resize(EditLine *);
 const LineInfo	*el_line(EditLine *);
 int		 el_insertstr(EditLine *, const char *);
 void		 el_deletestr(EditLine *, int);
-int		 el_replacestr(EditLine *el, const char *str);
-int		 el_deletestr1(EditLine *el, int start, int end);
+int		 el_replacestr(EditLine *, const char *);
+int		 el_deletestr1(EditLine *, int, int);
 
 /*
  * ==== History ====

Reply via email to