diff options
| author | Gerd Moellmann | 2001-01-26 09:32:03 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-01-26 09:32:03 +0000 |
| commit | 995d76897c1500d3dc9fe103394678fee7334c6b (patch) | |
| tree | 89ae514afe3c2ee7ade93fba0214a78867b2e806 /lib-src | |
| parent | 207d7545b7d72fbfa68402cd45441f563cecd5df (diff) | |
| download | emacs-995d76897c1500d3dc9fe103394678fee7334c6b.tar.gz emacs-995d76897c1500d3dc9fe103394678fee7334c6b.zip | |
(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')
| -rw-r--r-- | lib-src/ebrowse.c | 18 |
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 () | |||
| 1949 | } | 1949 | } |
| 1950 | 1950 | ||
| 1951 | 1951 | ||
| 1952 | /* Actually local to matching_regexp. These variables must be in | ||
| 1953 | global scope for the case that `static' get's defined away. */ | ||
| 1954 | |||
| 1955 | static char *matching_regexp_buffer, *matching_regexp_end_buf; | ||
| 1956 | |||
| 1957 | |||
| 1952 | /* Value is the string from the start of the line to the current | 1958 | /* Value is the string from the start of the line to the current |
| 1953 | position in the input buffer, or maybe a bit more if that string is | 1959 | position in the input buffer, or maybe a bit more if that string is |
| 1954 | shorter than min_regexp. */ | 1960 | shorter than min_regexp. */ |
| @@ -1959,15 +1965,14 @@ matching_regexp () | |||
| 1959 | char *p; | 1965 | char *p; |
| 1960 | char *s; | 1966 | char *s; |
| 1961 | char *t; | 1967 | char *t; |
| 1962 | static char *buffer, *end_buf; | ||
| 1963 | 1968 | ||
| 1964 | if (!f_regexps) | 1969 | if (!f_regexps) |
| 1965 | return NULL; | 1970 | return NULL; |
| 1966 | 1971 | ||
| 1967 | if (buffer == NULL) | 1972 | if (matching_regexp_buffer == NULL) |
| 1968 | { | 1973 | { |
| 1969 | buffer = (char *) xmalloc (max_regexp); | 1974 | matching_regexp_buffer = (char *) xmalloc (max_regexp); |
| 1970 | end_buf = &buffer[max_regexp] - 1; | 1975 | matching_regexp_end_buf = &matching_regexp_buffer[max_regexp] - 1; |
| 1971 | } | 1976 | } |
| 1972 | 1977 | ||
| 1973 | /* Scan back to previous newline of buffer start. */ | 1978 | /* Scan back to previous newline of buffer start. */ |
| @@ -1989,7 +1994,8 @@ matching_regexp () | |||
| 1989 | /* Copy from end to make sure significant portions are included. | 1994 | /* Copy from end to make sure significant portions are included. |
| 1990 | This implies that in the browser a regular expressing of the form | 1995 | This implies that in the browser a regular expressing of the form |
| 1991 | `^.*{regexp}' has to be used. */ | 1996 | `^.*{regexp}' has to be used. */ |
| 1992 | for (s = end_buf - 1, t = in; s > buffer && t > p;) | 1997 | for (s = matching_regexp_end_buf - 1, t = in; |
| 1998 | s > matching_regexp_buffer && t > p;) | ||
| 1993 | { | 1999 | { |
| 1994 | *--s = *--t; | 2000 | *--s = *--t; |
| 1995 | 2001 | ||
| @@ -1997,7 +2003,7 @@ matching_regexp () | |||
| 1997 | *--s = '\\'; | 2003 | *--s = '\\'; |
| 1998 | } | 2004 | } |
| 1999 | 2005 | ||
| 2000 | *(end_buf - 1) = '\0'; | 2006 | *(matching_regexp_end_buf - 1) = '\0'; |
| 2001 | return xstrdup (s); | 2007 | return xstrdup (s); |
| 2002 | } | 2008 | } |
| 2003 | 2009 | ||