summaryrefslogtreecommitdiff
path: root/lib-src/ebrowse.c
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-01-26 09:32:03 +0000
committerGerd Moellmann <gerd@gnu.org>2001-01-26 09:32:03 +0000
commit995d76897c1500d3dc9fe103394678fee7334c6b (patch)
tree89ae514afe3c2ee7ade93fba0214a78867b2e806 /lib-src/ebrowse.c
parent207d7545b7d72fbfa68402cd45441f563cecd5df (diff)
downloademacs-995d76897c1500d3dc9fe103394678fee7334c6b.tar.gz
(matching_regexp_buffer, matching_regexp_end_buf):
New variables. (matching_regexp): Use them instead of static variables in function scope.
Diffstat (limited to 'lib-src/ebrowse.c')
-rw-r--r--lib-src/ebrowse.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 5a9f155805c..58e9c45945d 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1949,6 +1949,12 @@ yylex ()
}
+/* Actually local to matching_regexp. These variables must be in
+ global scope for the case that `static' get's defined away. */
+
+static char *matching_regexp_buffer, *matching_regexp_end_buf;
+
+
/* Value is the string from the start of the line to the current
position in the input buffer, or maybe a bit more if that string is
shorter than min_regexp. */
@@ -1959,15 +1965,14 @@ matching_regexp ()
char *p;
char *s;
char *t;
- static char *buffer, *end_buf;
if (!f_regexps)
return NULL;
- if (buffer == NULL)
+ if (matching_regexp_buffer == NULL)
{
- buffer = (char *) xmalloc (max_regexp);
- end_buf = &buffer[max_regexp] - 1;
+ matching_regexp_buffer = (char *) xmalloc (max_regexp);
+ matching_regexp_end_buf = &matching_regexp_buffer[max_regexp] - 1;
}
/* Scan back to previous newline of buffer start. */
@@ -1989,7 +1994,8 @@ matching_regexp ()
/* Copy from end to make sure significant portions are included.
This implies that in the browser a regular expressing of the form
`^.*{regexp}' has to be used. */
- for (s = end_buf - 1, t = in; s > buffer && t > p;)
+ for (s = matching_regexp_end_buf - 1, t = in;
+ s > matching_regexp_buffer && t > p;)
{
*--s = *--t;
@@ -1997,7 +2003,7 @@ matching_regexp ()
*--s = '\\';
}
- *(end_buf - 1) = '\0';
+ *(matching_regexp_end_buf - 1) = '\0';
return xstrdup (s);
}