comparison src/search.c @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 95016f13131a
children
comparison
equal deleted inserted replaced
423:28d9c139be4c 424:11054d720c21
52 /* Nonzero means regexp was compiled to do full POSIX backtracking. */ 52 /* Nonzero means regexp was compiled to do full POSIX backtracking. */
53 char posix; 53 char posix;
54 }; 54 };
55 55
56 /* The instances of that struct. */ 56 /* The instances of that struct. */
57 struct regexp_cache searchbufs[REGEXP_CACHE_SIZE]; 57 static struct regexp_cache searchbufs[REGEXP_CACHE_SIZE];
58 58
59 /* The head of the linked list; points to the most recently used buffer. */ 59 /* The head of the linked list; points to the most recently used buffer. */
60 struct regexp_cache *searchbuf_head; 60 static struct regexp_cache *searchbuf_head;
61 61
62 62
63 /* Every call to re_match, etc., must pass &search_regs as the regs 63 /* Every call to re_match, etc., must pass &search_regs as the regs
64 argument unless you can show it is unnecessary (i.e., if re_match 64 argument unless you can show it is unnecessary (i.e., if re_match
65 is certainly going to be called again before region-around-match 65 is certainly going to be called again before region-around-match
2572 DEFSUBR (Fregexp_quote); 2572 DEFSUBR (Fregexp_quote);
2573 DEFSUBR (Fset_word_regexp); 2573 DEFSUBR (Fset_word_regexp);
2574 } 2574 }
2575 2575
2576 void 2576 void
2577 vars_of_search (void) 2577 reinit_vars_of_search (void)
2578 { 2578 {
2579 REGISTER int i; 2579 int i;
2580
2581 last_thing_searched = Qnil;
2582 staticpro_nodump (&last_thing_searched);
2580 2583
2581 for (i = 0; i < REGEXP_CACHE_SIZE; ++i) 2584 for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
2582 { 2585 {
2583 searchbufs[i].buf.allocated = 100; 2586 searchbufs[i].buf.allocated = 100;
2584 searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100); 2587 searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100);
2585 searchbufs[i].buf.fastmap = searchbufs[i].fastmap; 2588 searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
2586 searchbufs[i].regexp = Qnil; 2589 searchbufs[i].regexp = Qnil;
2587 staticpro (&searchbufs[i].regexp); 2590 staticpro_nodump (&searchbufs[i].regexp);
2588 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]); 2591 searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
2589 } 2592 }
2590 searchbuf_head = &searchbufs[0]; 2593 searchbuf_head = &searchbufs[0];
2591 2594 }
2592 last_thing_searched = Qnil; 2595
2593 staticpro (&last_thing_searched); 2596 void
2597 vars_of_search (void)
2598 {
2599 reinit_vars_of_search ();
2594 2600
2595 DEFVAR_LISP ("forward-word-regexp", &Vforward_word_regexp /* 2601 DEFVAR_LISP ("forward-word-regexp", &Vforward_word_regexp /*
2596 *Regular expression to be used in `forward-word'. 2602 *Regular expression to be used in `forward-word'.
2597 #### Not yet implemented. 2603 #### Not yet implemented.
2598 */ ); 2604 */ );