Skip to content

Commit dc5077c

Browse files
committed
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.
1 parent 013dcab commit dc5077c

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

ext/com_dotnet/com_com.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,7 @@ PHP_METHOD(com, __construct)
239239
/* see if it has TypeInfo available */
240240
if (FAILED(IDispatch_GetTypeInfo(V_DISPATCH(&obj->v), 0, LANG_NEUTRAL, &obj->typeinfo)) && typelib_name) {
241241
/* load up the library from the named file */
242-
int cached;
243-
244-
TL = php_com_load_typelib_via_cache(typelib_name, obj->code_page, &cached);
242+
TL = php_com_load_typelib_via_cache(typelib_name, obj->code_page);
245243

246244
if (TL) {
247245
if (COMG(autoreg_on)) {
@@ -819,7 +817,6 @@ PHP_FUNCTION(com_load_typelib)
819817
ITypeLib *pTL = NULL;
820818
zend_bool cs = TRUE;
821819
int codepage = COMG(code_page);
822-
int cached = 0;
823820

824821
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &name, &namelen, &cs)) {
825822
RETURN_THROWS();
@@ -832,7 +829,7 @@ PHP_FUNCTION(com_load_typelib)
832829
RETVAL_FALSE;
833830

834831
php_com_initialize();
835-
pTL = php_com_load_typelib_via_cache(name, codepage, &cached);
832+
pTL = php_com_load_typelib_via_cache(name, codepage);
836833
if (pTL) {
837834
if (php_com_import_typelib(pTL, cs ? CONST_CS : 0, codepage) == SUCCESS) {
838835
RETVAL_TRUE;

ext/com_dotnet/com_extension.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
7575
FILE *typelib_file;
7676
char *typelib_name_buffer;
7777
char *strtok_buf = NULL;
78-
int cached;
7978

8079
if (NULL == new_value || !new_value->val[0] || (typelib_file = VCWD_FOPEN(new_value->val, "r"))==NULL) {
8180
return FAILURE;
@@ -114,7 +113,7 @@ static PHP_INI_MH(OnTypeLibFileUpdate)
114113
ptr--;
115114
}
116115

117-
if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page), &cached)) != NULL) {
116+
if ((pTL = php_com_load_typelib_via_cache(typelib_name, COMG(code_page))) != NULL) {
118117
php_com_import_typelib(pTL, mode, COMG(code_page));
119118
ITypeLib_Release(pTL);
120119
}

ext/com_dotnet/com_typeinfo.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,7 @@ ITypeLib *php_com_cache_typelib(ITypeLib* TL, char *cache_key, zend_long cache_k
260260
return result;
261261
}
262262

263-
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string,
264-
int codepage, int *cached)
263+
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string, int codepage)
265264
{
266265
ITypeLib *TL;
267266
char *name_dup;
@@ -272,14 +271,12 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_s
272271
#endif
273272

274273
if ((TL = zend_hash_find_ptr(&php_com_typelibraries, key)) != NULL) {
275-
*cached = 1;
276274
/* add a reference for the caller */
277275
ITypeLib_AddRef(TL);
278276

279277
goto php_com_load_typelib_via_cache_return;
280278
}
281279

282-
*cached = 0;
283280
name_dup = estrndup(ZSTR_VAL(key), ZSTR_LEN(key));
284281
TL = php_com_load_typelib(name_dup, codepage);
285282
efree(name_dup);

ext/com_dotnet/php_com_dotnet_internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ PHP_COM_DOTNET_API void php_com_wrap_variant(zval *z, VARIANT *v,
132132
PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG dim1);
133133

134134
/* com_typeinfo.c */
135-
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string,
136-
int codepage, int *cached);
135+
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(const char *search_string, int codepage);
137136
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codepage);
138137
PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode,
139138
int codepage);

0 commit comments

Comments
 (0)