1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

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.
This commit is contained in:
Christoph M. Becker
2020-08-11 11:37:52 +02:00
parent 013dcab344
commit dc5077cc53
4 changed files with 5 additions and 13 deletions

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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);