diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2015-10-09 21:24:06 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2015-10-09 21:24:06 +0000 |
commit | c43fd83a883f62e9d6f8dc437c5051dcfe63f54d (patch) | |
tree | 5164ab3f915b94a80a995e17b2d48bf3f7d9671b | |
parent | f2484860686bfd7eaa77db4c30874d3d7137d59d (diff) |
The variable errmsg can be static in main.c if code in re.c uses an own
buffer to construct error messages.
with input by and ok millert@
-rw-r--r-- | bin/ed/ed.h | 3 | ||||
-rw-r--r-- | bin/ed/main.c | 3 | ||||
-rw-r--r-- | bin/ed/re.c | 7 |
3 files changed, 7 insertions, 6 deletions
diff --git a/bin/ed/ed.h b/bin/ed/ed.h index 459688f8980..462a1ac8c31 100644 --- a/bin/ed/ed.h +++ b/bin/ed/ed.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ed.h,v 1.20 2015/10/09 20:27:28 tobias Exp $ */ +/* $OpenBSD: ed.h,v 1.21 2015/10/09 21:24:05 tobias Exp $ */ /* $NetBSD: ed.h,v 1.23 1995/03/21 09:04:40 cgd Exp $ */ /* ed.h: type and constant definitions for the ed editor. */ @@ -202,7 +202,6 @@ extern volatile sig_atomic_t sigint; /* global vars */ extern int addr_last; extern int current_addr; -extern char errmsg[PATH_MAX + 40]; extern int first_addr; extern int lineno; extern int second_addr; diff --git a/bin/ed/main.c b/bin/ed/main.c index 14e60082b91..2489a63e1c9 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.52 2015/10/09 20:27:28 tobias Exp $ */ +/* $OpenBSD: main.c,v 1.53 2015/10/09 21:24:05 tobias Exp $ */ /* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */ /* main.c: This file contains the main control and user-interface routines @@ -72,6 +72,7 @@ static line_t *dup_line_node(line_t *); sigjmp_buf env; /* static buffers */ +static char errmsg[PATH_MAX + 40]; /* error message buffer */ static char *shcmd; /* shell command buffer */ static int shcmdsz; /* shell command buffer size */ static int shcmdi; /* shell command buffer index */ diff --git a/bin/ed/re.c b/bin/ed/re.c index 7db4096dd73..eea8c267475 100644 --- a/bin/ed/re.c +++ b/bin/ed/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.15 2015/10/09 20:27:28 tobias Exp $ */ +/* $OpenBSD: re.c,v 1.16 2015/10/09 21:24:05 tobias Exp $ */ /* $NetBSD: re.c,v 1.14 1995/03/21 09:04:48 cgd Exp $ */ /* re.c: This file contains the regular expression interface routines for @@ -36,7 +36,6 @@ static char *parse_char_class(char *); extern int patlock; -char errmsg[PATH_MAX + 40] = ""; /* get_compiled_pattern: return pointer to compiled pattern from command buffer */ @@ -44,6 +43,7 @@ regex_t * get_compiled_pattern(void) { static regex_t *exp = NULL; + char errbuf[128] = ""; char *exps; char delimiter; @@ -68,7 +68,8 @@ get_compiled_pattern(void) } patlock = 0; if ((n = regcomp(exp, exps, 0)) != 0) { - regerror(n, exp, errmsg, sizeof errmsg); + regerror(n, exp, errbuf, sizeof errbuf); + seterrmsg(errbuf); free(exp); return exp = NULL; } |