CVS update: php3/functions

From: Date: Fri, 04 Dec 1998 20:19:16 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2670@lists.php.net to get a copy of this message
Date: Friday December 4, 1998 @ 15:19 Author: ssb Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv3880/functions Modified Files: dav.c Log Message: a few DAV bugfixes Index: php3/functions/dav.c diff -c php3/functions/dav.c:1.1 php3/functions/dav.c:1.2 *** php3/functions/dav.c:1.1 Fri Dec 4 11:38:04 1998 --- php3/functions/dav.c Fri Dec 4 15:19:16 1998 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: dav.c,v 1.1 1998/12/04 16:38:04 ssb Exp $ */ #define IS_EXT_MODULE #if COMPILE_DL --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: dav.c,v 1.2 1998/12/04 20:19:16 ssb Exp $ */ #define IS_EXT_MODULE #if COMPILE_DL *************** *** 48,53 **** --- 48,54 ---- #if HAVE_MOD_DAV # include "mod_dav.h" + # include "phpdav.h" # include "variables.h" /* {{{ thread safety stuff */ *************** *** 72,77 **** --- 73,83 ---- # endif /* defined(THREAD_SAFE) */ + # define DAV_HANDLER(a) DAV_GLOBAL(php3_dav_module).a##_handler + # define DAV_SET_HANDLER(a,b) \ + dav_set_handler(&DAV_GLOBAL(php3_dav_module).a##_handler,(b)) + + /* }}} */ /* {{{ dynamically loadable module stuff */ *************** *** 120,135 **** PHP3_MUTEX_LOCK(phpdav_mutex); numthreads++; if (numthreads==1){ ! if (!PHP3_TLS_PROC_STARTUP(PHPDAVTls)){ ! PHP3_MUTEX_UNLOCK(phpdav_mutex); ! PHP3_MUTEX_FREE(phpdav_mutex); ! return FAILURE; ! } } PHP3_MUTEX_UNLOCK(phdpav_mutex); if(!PHP3_TLS_THREAD_INIT(PHPDAVTls,phpdav_globals,phpdav_global_struct)){ ! PHP3_MUTEX_FREE(phpdav_mutex); ! return FAILURE; } #endif return SUCCESS; --- 126,141 ---- PHP3_MUTEX_LOCK(phpdav_mutex); numthreads++; if (numthreads==1){ ! if (!PHP3_TLS_PROC_STARTUP(PHPDAVTls)){ ! PHP3_MUTEX_UNLOCK(phpdav_mutex); ! PHP3_MUTEX_FREE(phpdav_mutex); ! return FAILURE; ! } } PHP3_MUTEX_UNLOCK(phdpav_mutex); if(!PHP3_TLS_THREAD_INIT(PHPDAVTls,phpdav_globals,phpdav_global_struct)){ ! PHP3_MUTEX_FREE(phpdav_mutex); ! return FAILURE; } #endif return SUCCESS; *************** *** 154,163 **** PHP3_MUTEX_LOCK(phpdav_mutex); numthreads--; if (numthreads < 1) { ! PHP3_TLS_PROC_SHUTDOWN(PHPDAVTls); ! PHP3_MUTEX_UNLOCK(phpdav_mutex); ! PHP3_MUTEX_FREE(phpdav_mutex); ! return SUCCESS; } PHP3_MUTEX_UNLOCK(phpdav_mutex); #endif --- 160,169 ---- PHP3_MUTEX_LOCK(phpdav_mutex); numthreads--; if (numthreads < 1) { ! PHP3_TLS_PROC_SHUTDOWN(PHPDAVTls); ! PHP3_MUTEX_UNLOCK(phpdav_mutex); ! PHP3_MUTEX_FREE(phpdav_mutex); ! return SUCCESS; } PHP3_MUTEX_UNLOCK(phpdav_mutex); #endif *************** *** 170,179 **** int php3_rshutdown_phpdav() { if (DAV_HANDLER(mkcol_test)) { ! efree(DAV_HANDLER(mkcol_test)); } if (DAV_HANDLER(mkcol_create)) { ! efree(DAV_HANDLER(mkcol_create)); } return SUCCESS; } --- 176,185 ---- int php3_rshutdown_phpdav() { if (DAV_HANDLER(mkcol_test)) { ! efree(DAV_HANDLER(mkcol_test)); } if (DAV_HANDLER(mkcol_create)) { ! efree(DAV_HANDLER(mkcol_create)); } return SUCCESS; } *************** *** 192,263 **** /* {{{ dav_set_handler() */ - # define DAV_HANDLER(a) DAV_GLOBAL(php3_dav_module).a##_handler - # define DAV_SET_HANDLER(a,b) \ - dav_set_handler(&DAV_GLOBAL(php3_dav_module).a##_handler,(b)) - static void dav_set_handler(char **nameBufp, pval *data) { if (data->value.str.len > 0) { ! if (*nameBufp != NULL) { ! efree(*nameBufp); ! } ! *nameBufp = php3i_pval_strdup(data); } else { ! if (*nameBufp != NULL) { ! efree(*nameBufp); ! } ! *nameBufp = NULL; } } /* }}} */ /* {{{ dav_call_handler() */ ! static pval * dav_call_handler(char *funcName, int argc, pval **argv) { if (funcName) { ! pval *retval, *func; ! int i; ! HashTable *function_table; ! ! func = php3i_string_pval(funcName); ! retval = emalloc(sizeof(pval)); ! function_table = php3i_get_function_table(); ! if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) { ! php3tls_pval_destructor(retval); ! efree(retval); ! return NULL; ! } ! php3tls_pval_destructor(func); ! efree(func); ! for (i = 0; i < argc; i++) { ! php3tls_pval_destructor(argv[i]); ! efree(argv[i]); ! } ! return retval; } ! return NULL; } /* }}} */ int phpdav_mkcol_test_handler(request_rec *r) { ! pval *retval, *arg; if (DAV_HANDLER(mkcol_test) == NULL) { ! return DECLINED; } arg = php3i_string_pval(r->filename); ! if ((retval = dav_call_handler(DAV_HANDLER(mkcol_test), 1, &arg))) { ! php3tls_pval_destructor(retval); ! efree(retval); } ! convert_to_long(retval); ! return retval->value.lval; } /* }}} */ --- 198,272 ---- /* {{{ dav_set_handler() */ static void dav_set_handler(char **nameBufp, pval *data) { if (data->value.str.len > 0) { ! if (*nameBufp != NULL) { ! efree(*nameBufp); ! } ! *nameBufp = php3i_pval_strdup(data); } else { ! if (*nameBufp != NULL) { ! efree(*nameBufp); ! } ! *nameBufp = NULL; } } /* }}} */ /* {{{ dav_call_handler() */ ! static int dav_call_handler(char *funcName, int argc, pval **argv) { if (funcName) { ! pval *retval, *func; ! int i; ! HashTable *function_table; ! ! func = php3i_string_pval(funcName); ! retval = emalloc(sizeof(pval)); ! function_table = php3i_get_function_table(); ! if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) { ! php3tls_pval_destructor(retval); ! efree(retval); ! return HTTP_INTERNAL_SERVER_ERROR; ! } ! php3tls_pval_destructor(func); ! efree(func); ! for (i = 0; i < argc; i++) { ! php3tls_pval_destructor(argv[i]); ! efree(argv[i]); ! } ! convert_to_long(retval); ! return retval->value.lval; } ! return DECLINED; } /* }}} */ int phpdav_mkcol_test_handler(request_rec *r) { ! pval *arg; if (DAV_HANDLER(mkcol_test) == NULL) { ! return DECLINED; } arg = php3i_string_pval(r->filename); ! return dav_call_handler(DAV_HANDLER(mkcol_test), 1, &arg); ! } ! ! int phpdav_mkcol_create_handler(request_rec *r) ! { ! pval *arg; ! ! if (DAV_HANDLER(mkcol_create) == NULL) { ! return DECLINED; } ! arg = php3i_string_pval(r->filename); ! return dav_call_handler(DAV_HANDLER(mkcol_create), 1, &arg); } /* }}} */ *************** *** 272,278 **** DAV_TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &test, &create) == FAILURE) { ! WRONG_PARAM_COUNT; } DAV_SET_HANDLER(mkcol_test, test); DAV_SET_HANDLER(mkcol_create, create); --- 281,287 ---- DAV_TLS_VARS; if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &test, &create) == FAILURE) { ! WRONG_PARAM_COUNT; } DAV_SET_HANDLER(mkcol_test, test); DAV_SET_HANDLER(mkcol_create, create); -- 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 (#2670) next »