CVS update: php3

From: Date: Fri, 25 Dec 1998 20:09:46 +0000
Subject: CVS update: php3
Groups: php.dev 
Request: Send a blank email to php-dev+get-3038@lists.php.net to get a copy of this message
Date: Friday December 25, 1998 @ 15:09 Author: sas Update of /repository/php3 In directory asf:/u/temp/cvs-serv5567 Modified Files: list.c php.h php3_list.h Log Message: speed up regexes by introducing a simple cache which is effective in the simplest case - using always the same regex Index: php3/list.c diff -c php3/list.c:1.83 php3/list.c:1.84 *** php3/list.c:1.83 Tue Aug 25 14:48:56 1998 --- php3/list.c Fri Dec 25 15:09:45 1998 *************** *** 29,35 **** */ ! /* $Id: list.c,v 1.83 1998/08/25 18:48:56 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" --- 29,35 ---- */ ! /* $Id: list.c,v 1.84 1998/12/25 20:09:45 sas Exp $ */ #ifdef THREAD_SAFE #include "tls.h" *************** *** 97,102 **** --- 97,110 ---- if (_php3_hash_index_find(&GLOBAL(list_destructors),le->type,(void **) &ld)==SUCCESS) { if (ld->list_destructor) { (ld->list_destructor)(le->ptr); + } + } else if(le->type == LE_REGEX) { + reg_cache *rc = (reg_cache *) le->ptr; + + if(rc->cflags != -1) { + regfree(&rc->preg); + efree(rc->pattern); + rc->pattern = NULL; } } else { php3_error(E_WARNING,"Unknown list entry type in request shutdown (%d)",le->type); Index: php3/php.h diff -c php3/php.h:1.39 php3/php.h:1.40 *** php3/php.h:1.39 Thu Dec 3 17:58:48 1998 --- php3/php.h Fri Dec 25 15:09:45 1998 *************** *** 28,34 **** +----------------------------------------------------------------------+ */ ! /* $Id: php.h,v 1.39 1998/12/03 22:58:48 shane Exp $ */ #ifndef _PHP_H #define _PHP_H --- 28,34 ---- +----------------------------------------------------------------------+ */ ! /* $Id: php.h,v 1.40 1998/12/25 20:09:45 sas Exp $ */ #ifndef _PHP_H #define _PHP_H *************** *** 440,445 **** --- 440,451 ---- pval *object_pointer; } FunctionState; + + typedef struct { + regex_t preg; + char *pattern; + int cflags; + } reg_cache; /* global variables */ #ifndef THREAD_SAFE Index: php3/php3_list.h diff -c php3/php3_list.h:1.4 php3/php3_list.h:1.5 *** php3/php3_list.h:1.4 Sat May 16 18:03:43 1998 --- php3/php3_list.h Fri Dec 25 15:09:45 1998 *************** *** 29,35 **** */ ! /* $Id: php3_list.h,v 1.4 1998/05/16 22:03:43 zeev Exp $ */ #ifndef _LIST_H --- 29,35 ---- */ ! /* $Id: php3_list.h,v 1.5 1998/12/25 20:09:45 sas Exp $ */ #ifndef _LIST_H *************** *** 55,61 **** extern PHPAPI int _register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number); enum list_entry_type { ! LE_DB=1000 }; extern PHPAPI int php3_list_do_insert(HashTable *list,void *ptr, int type); --- 55,62 ---- extern PHPAPI int _register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number); enum list_entry_type { ! LE_DB=1000, ! LE_REGEX }; extern PHPAPI int php3_list_do_insert(HashTable *list,void *ptr, int type); -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3038) next »