[svn-commits] seanbright: editline/trunk r155 - /editline/trunk/src/parse.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 19 13:49:29 CDT 2010


Author: seanbright
Date: Fri Mar 19 13:49:25 2010
New Revision: 155

URL: http://svnview.digium.com/svn/thirdparty?view=rev&rev=155
Log:
Be smarter about how we walk the bindings array so we don't overrun.

Modified:
    editline/trunk/src/parse.c

Modified: editline/trunk/src/parse.c
URL: http://svnview.digium.com/svn/thirdparty/editline/trunk/src/parse.c?view=diff&rev=155&r1=154&r2=155
==============================================================================
--- editline/trunk/src/parse.c (original)
+++ editline/trunk/src/parse.c Fri Mar 19 13:49:25 2010
@@ -254,10 +254,10 @@
 protected int
 parse_cmd(EditLine *el, const char *cmd)
 {
-	el_bindings_t *b;
-
-	for (b = el->el_map.help; b->name != NULL; b++)
-		if (strcmp(b->name, cmd) == 0)
-			return (b->func);
+	el_bindings_t *bp, *ep;
+	ep = &el->el_map.help[el->el_map.nfunc];
+	for (bp = el->el_map.help; bp < ep; bp++)
+		if (strcmp(bp->name, cmd) == 0)
+			return (bp->func);
 	return (-1);
 }




More information about the svn-commits mailing list