From 3f3190e34c5d39986fae0ec03f37cf5509dd9c93 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Thu, 21 Dec 2006 00:22:03 +0000 Subject: less: total cleanup and bugfix. Doesn't die horribly on binary files anymore. In fact, they _100%_ work now. Control chars are in reverse video, including DEL and that idiocy of VT-10x, Meta-ESC [inventor of which should be prohibited from reproducing]. Regex search is fixed also. When you specify search ('/' key), control chars turn into dots (unhighlighted), and found occurrences highlighted instead. This is reversible. Memory management fixed (was leaky as hell) and optimized. Linewrapping fixed and thoroughly tested. Max buffer size made configurable. ~ 600 bytes saved. --- libbb/xregcomp.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'libbb/xregcomp.c') diff --git a/libbb/xregcomp.c b/libbb/xregcomp.c index 4bcb9aedf..6e9a29f49 100644 --- a/libbb/xregcomp.c +++ b/libbb/xregcomp.c @@ -8,16 +8,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include #include "libbb.h" #include "xregex.h" - - void xregcomp(regex_t *preg, const char *regex, int cflags) { - int ret; - if ((ret = regcomp(preg, regex, cflags)) != 0) { + int ret = regcomp(preg, regex, cflags); + if (ret) { int errmsgsz = regerror(ret, preg, NULL, 0); char *errmsg = xmalloc(errmsgsz); regerror(ret, preg, errmsg, errmsgsz); -- cgit v1.2.3