From dc5077cc53483d3ec02853b0b92e1837e4e24dee Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 11 Aug 2020 11:37:52 +0200 Subject: [PATCH] Remove practically unused parameter The `cached` out parameter of `php_com_load_typelib_via_cache()` was meant to signal whether a particular typelib actually has been cached. This is not really relevant, though, for the imagined purposes, and since the parameter is no longer really used, we removed it altohether. --- ext/com_dotnet/com_com.c | 7 ++----- ext/com_dotnet/com_extension.c | 3 +-- ext/com_dotnet/com_typeinfo.c | 5 +---- ext/com_dotnet/php_com_dotnet_internal.h | 3 +-- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index a279869d28..156636db38 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -239,9 +239,7 @@ PHP_METHOD(com, __construct) /* see if it has TypeInfo available */ if (FAILED(IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo)) && typelib_name) { /* load up the library from the named file */ - int cached; - - TL = php_com_load_typelib_via_cache(typelib_name, obj->code_page, &cached); + TL = php_com_load_typelib_via_cache(typelib_name, obj->code_page); if (TL) { if (COMG(autoreg_on)) { @@ -819,7 +817,6 @@ PHP_FUNCTION(com_load_typelib) ITypeLib *pTL = NULL; zend_bool cs = TRUE; int codepage = COMG(code_page); - int cached = 0; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &name, &namelen, &cs)) { RETURN_THROWS(); @@ -832,7 +829,7 @@ PHP_FUNCTION(com_load_typelib) RETVAL_FALSE; php_com_initialize(); - pTL = php_com_load_typelib_via_cache(name, codepage, &cached); + pTL = php_com_load_typelib_via_cache(name, codepage); if (pTL) { if (php_com_import_typelib(pTL, cs ? CONST_CS : 0, codepage) == SUCCESS) { RETVAL_TRUE; diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 28909bee87..0535509412 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -75,7 +75,6 @@ static PHP_INI_MH(OnTypeLibFileUpdate) FILE *typelib_file; char *typelib_name_buffer; char *strtok_buf = NULL; - int cached; if (NULL == new_value || !new_value->val[0] || (typelib_file = VCWD_FOPEN(new_value->val, "r"))==NULL) { return FAILURE; @@ -114,7 +113,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate) ptr--; } - if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page), &cached)) != NULL) { + if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page))) != NULL) { php_com_import_typelib(pTL, mode, COMG(code_page)); ITypeLib_Release(pTL); } diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index ffd2400f75..4112b0ce06 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -260,8 +260,7 @@ ITypeLib *php_com_cache_typelib(ITypeLib* TL, char *cache_key, zend_long cache_k return result; } -PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string, - int codepage, int *cached) +PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string, int codepage) { ITypeLib *TL; char *name_dup; @@ -272,14 +271,12 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_s #endif if ((TL = zend_hash_find_ptr(&php_com_typelibraries, key)) != NULL) { - *cached = 1; /* add a reference for the caller */ ITypeLib_AddRef(TL); goto php_com_load_typelib_via_cache_return; } - *cached = 0; name_dup = estrndup(ZSTR_VAL(key), ZSTR_LEN(key)); TL = php_com_load_typelib(name_dup, codepage); efree(name_dup); diff --git a/ext/com_dotnet/php_com_dotnet_internal.h b/ext/com_dotnet/php_com_dotnet_internal.h index 1d089a2ed6..e80bf6e312 100644 --- a/ext/com_dotnet/php_com_dotnet_internal.h +++ b/ext/com_dotnet/php_com_dotnet_internal.h @@ -132,8 +132,7 @@ PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v, PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1); /* com_typeinfo.c */ -PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string, - int codepage, int *cached); +PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string, int codepage); PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage); PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepage); -- 2.40.0