vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit ff6d1d3c3636b934a50fff3357a01ad3c15c59d0
parent a5e186cc4230682281a87b9cf1ae338f7ca939bf
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 11 Sep 2014 10:32:31 +0200

Avoid segfault if no previous search has been performed

Diffstat:
Mtext.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/text.c b/text.c @@ -1048,7 +1048,11 @@ const char *text_filename(Text *txt) { } Regex *text_regex_new(void) { - return calloc(1, sizeof(Regex)); + Regex *r = calloc(1, sizeof(Regex)); + if (!r) + return NULL; + regcomp(&r->regex, "\0\0", 0); /* this should not match anything */ + return r; } int text_regex_compile(Regex *regex, const char *string, int cflags) {