Skip to content

Commit bc4fa01

Browse files
authored
Get rid of reserved name usage in ext/libxml (#16707)
Names starting with an _ are reserved in C.
1 parent 6366da4 commit bc4fa01

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

ext/libxml/libxml.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
#include "libxml_arginfo.h"
5050

5151
/* a true global for initialization */
52-
static int _php_libxml_initialized = 0;
53-
static int _php_libxml_per_request_initialization = 1;
54-
static xmlExternalEntityLoader _php_libxml_default_entity_loader;
52+
static int php_libxml_initialized = 0;
53+
static int php_libxml_per_request_initialization = 1;
54+
static xmlExternalEntityLoader php_libxml_default_entity_loader;
5555

56-
typedef struct _php_libxml_func_handler {
56+
typedef struct php_libxml_func_handler {
5757
php_libxml_export_node export_func;
5858
} php_libxml_func_handler;
5959

@@ -601,16 +601,16 @@ php_libxml_output_buffer_create_filename(const char *URI,
601601
return(ret);
602602
}
603603

604-
static void _php_libxml_free_error(void *ptr)
604+
static void php_libxml_free_error(void *ptr)
605605
{
606606
/* This will free the libxml alloc'd memory */
607607
xmlResetError((xmlErrorPtr) ptr);
608608
}
609609

610610
#if LIBXML_VERSION >= 21200
611-
static void _php_list_set_error_structure(const xmlError *error, const char *msg, int line, int column)
611+
static void php_list_set_error_structure(const xmlError *error, const char *msg, int line, int column)
612612
#else
613-
static void _php_list_set_error_structure(xmlError *error, const char *msg, int line, int column)
613+
static void php_list_set_error_structure(xmlError *error, const char *msg, int line, int column)
614614
#endif
615615
{
616616
xmlError error_copy;
@@ -655,7 +655,7 @@ static void php_libxml_ctx_error_level(int level, void *ctx, const char *msg, in
655655
void php_libxml_issue_error(int level, const char *msg)
656656
{
657657
if (LIBXML(error_list)) {
658-
_php_list_set_error_structure(NULL, msg, 0, 0);
658+
php_list_set_error_structure(NULL, msg, 0, 0);
659659
} else {
660660
php_error_docref(NULL, level, "%s", msg);
661661
}
@@ -681,7 +681,7 @@ static void php_libxml_internal_error_handler_ex(php_libxml_error_level error_ty
681681

682682
if (output) {
683683
if (LIBXML(error_list)) {
684-
_php_list_set_error_structure(NULL, ZSTR_VAL(LIBXML(error_buffer).s), line, column);
684+
php_list_set_error_structure(NULL, ZSTR_VAL(LIBXML(error_buffer).s), line, column);
685685
} else if (!EG(exception)) {
686686
/* Don't throw additional notices/warnings if an exception has already been thrown. */
687687
switch (error_type) {
@@ -712,7 +712,7 @@ PHP_LIBXML_API void php_libxml_error_handler_va(php_libxml_error_level error_typ
712712
php_libxml_internal_error_handler_ex(error_type, ctx, msg, ap, line, column);
713713
}
714714

715-
static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
715+
static xmlParserInputPtr php_libxml_external_entity_loader(const char *URL,
716716
const char *ID, xmlParserCtxtPtr context)
717717
{
718718
xmlParserInputPtr ret = NULL;
@@ -722,7 +722,7 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
722722

723723
/* no custom user-land callback set up; delegate to original loader */
724724
if (!ZEND_FCC_INITIALIZED(LIBXML(entity_loader_callback))) {
725-
return _php_libxml_default_entity_loader(URL, ID, context);
725+
return php_libxml_default_entity_loader(URL, ID, context);
726726
}
727727

728728
if (ID != NULL) {
@@ -821,7 +821,7 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
821821
return ret;
822822
}
823823

824-
static xmlParserInputPtr _php_libxml_pre_ext_ent_loader(const char *URL,
824+
static xmlParserInputPtr php_libxml_pre_ext_ent_loader(const char *URL,
825825
const char *ID, xmlParserCtxtPtr context)
826826
{
827827

@@ -833,11 +833,11 @@ static xmlParserInputPtr _php_libxml_pre_ext_ent_loader(const char *URL,
833833
* we don't even have a resource list by then), but then whether one
834834
* extension would be using the custom external entity loader or not
835835
* could depend on extension loading order
836-
* (if _php_libxml_per_request_initialization */
836+
* (if php_libxml_per_request_initialization */
837837
if (xmlGenericError == php_libxml_error_handler && PG(modules_activated)) {
838-
return _php_libxml_external_entity_loader(URL, ID, context);
838+
return php_libxml_external_entity_loader(URL, ID, context);
839839
} else {
840-
return _php_libxml_default_entity_loader(URL, ID, context);
840+
return php_libxml_default_entity_loader(URL, ID, context);
841841
}
842842
}
843843

@@ -879,7 +879,7 @@ static void php_libxml_structured_error_handler(void *userData, const xmlError *
879879
static void php_libxml_structured_error_handler(void *userData, xmlErrorPtr error)
880880
#endif
881881
{
882-
_php_list_set_error_structure(error, NULL, 0, 0);
882+
php_list_set_error_structure(error, NULL, 0, 0);
883883
}
884884

885885
PHP_LIBXML_API void php_libxml_error_handler(void *ctx, const char *msg, ...)
@@ -897,32 +897,32 @@ static void php_libxml_exports_dtor(zval *zv)
897897

898898
PHP_LIBXML_API void php_libxml_initialize(void)
899899
{
900-
if (!_php_libxml_initialized) {
900+
if (!php_libxml_initialized) {
901901
/* we should be the only one's to ever init!! */
902902
ZEND_IGNORE_LEAKS_BEGIN();
903903
xmlInitParser();
904904
ZEND_IGNORE_LEAKS_END();
905905

906-
_php_libxml_default_entity_loader = xmlGetExternalEntityLoader();
907-
xmlSetExternalEntityLoader(_php_libxml_pre_ext_ent_loader);
906+
php_libxml_default_entity_loader = xmlGetExternalEntityLoader();
907+
xmlSetExternalEntityLoader(php_libxml_pre_ext_ent_loader);
908908

909909
zend_hash_init(&php_libxml_exports, 0, NULL, php_libxml_exports_dtor, 1);
910910

911-
_php_libxml_initialized = 1;
911+
php_libxml_initialized = 1;
912912
}
913913
}
914914

915915
PHP_LIBXML_API void php_libxml_shutdown(void)
916916
{
917-
if (_php_libxml_initialized) {
917+
if (php_libxml_initialized) {
918918
#if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION < 21000
919919
xmlRelaxNGCleanupTypes();
920920
#endif
921921
/* xmlCleanupParser(); */
922922
zend_hash_destroy(&php_libxml_exports);
923923

924-
xmlSetExternalEntityLoader(_php_libxml_default_entity_loader);
925-
_php_libxml_initialized = 0;
924+
xmlSetExternalEntityLoader(php_libxml_default_entity_loader);
925+
php_libxml_initialized = 0;
926926
}
927927
}
928928

@@ -954,13 +954,13 @@ static PHP_MINIT_FUNCTION(libxml)
954954

955955
for (sapi_name = supported_sapis; *sapi_name; sapi_name++) {
956956
if (strcmp(sapi_module.name, *sapi_name) == 0) {
957-
_php_libxml_per_request_initialization = 0;
957+
php_libxml_per_request_initialization = 0;
958958
break;
959959
}
960960
}
961961
}
962962

963-
if (!_php_libxml_per_request_initialization) {
963+
if (!php_libxml_per_request_initialization) {
964964
/* report errors via handler rather than stderr */
965965
xmlSetGenericErrorFunc(NULL, php_libxml_error_handler);
966966
xmlParserInputBufferCreateFilenameDefault(php_libxml_input_buffer_create_filename);
@@ -973,7 +973,7 @@ static PHP_MINIT_FUNCTION(libxml)
973973

974974
static PHP_RINIT_FUNCTION(libxml)
975975
{
976-
if (_php_libxml_per_request_initialization) {
976+
if (php_libxml_per_request_initialization) {
977977
/* report errors via handler rather than stderr */
978978
xmlSetGenericErrorFunc(NULL, php_libxml_error_handler);
979979
xmlParserInputBufferCreateFilenameDefault(php_libxml_input_buffer_create_filename);
@@ -1000,7 +1000,7 @@ static PHP_RSHUTDOWN_FUNCTION(libxml)
10001000

10011001
static PHP_MSHUTDOWN_FUNCTION(libxml)
10021002
{
1003-
if (!_php_libxml_per_request_initialization) {
1003+
if (!php_libxml_per_request_initialization) {
10041004
xmlSetGenericErrorFunc(NULL, NULL);
10051005

10061006
xmlParserInputBufferCreateFilenameDefault(NULL);
@@ -1014,7 +1014,7 @@ static PHP_MSHUTDOWN_FUNCTION(libxml)
10141014
static zend_result php_libxml_post_deactivate(void)
10151015
{
10161016
/* reset libxml generic error handling */
1017-
if (_php_libxml_per_request_initialization) {
1017+
if (php_libxml_per_request_initialization) {
10181018
xmlSetGenericErrorFunc(NULL, NULL);
10191019

10201020
xmlParserInputBufferCreateFilenameDefault(NULL);
@@ -1097,7 +1097,7 @@ PHP_FUNCTION(libxml_use_internal_errors)
10971097
xmlSetStructuredErrorFunc(NULL, php_libxml_structured_error_handler);
10981098
if (LIBXML(error_list) == NULL) {
10991099
LIBXML(error_list) = (zend_llist *) emalloc(sizeof(zend_llist));
1100-
zend_llist_init(LIBXML(error_list), sizeof(xmlError), _php_libxml_free_error, 0);
1100+
zend_llist_init(LIBXML(error_list), sizeof(xmlError), php_libxml_free_error, 0);
11011101
}
11021102
}
11031103
RETURN_BOOL(retval);

0 commit comments

Comments
 (0)