Rename php_fetch_object with swig_ prefix

We shouldn't be using symbols starting `php` as that risks collisions
with future symbols defined by PHP.
This commit is contained in:
Olly Betts 2021-12-17 09:37:00 +13:00
commit 6253583809
2 changed files with 5 additions and 5 deletions

View file

@ -81,10 +81,10 @@ typedef struct {
zend_object std;
} swig_object_wrapper;
#define SWIG_Z_FETCH_OBJ_P(zv) php_fetch_object(Z_OBJ_P(zv))
#define SWIG_Z_FETCH_OBJ_P(zv) swig_php_fetch_object(Z_OBJ_P(zv))
static inline
swig_object_wrapper * php_fetch_object(zend_object *obj) {
swig_object_wrapper * swig_php_fetch_object(zend_object *obj) {
return (swig_object_wrapper *)((char *)obj - XtOffsetOf(swig_object_wrapper, std));
}
@ -115,7 +115,7 @@ SWIG_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject) {
obj = ce->create_object(ce);
ZVAL_OBJ(z, obj);
}
value = php_fetch_object(obj);
value = swig_php_fetch_object(obj);
value->ptr = ptr;
value->newobject = (newobject & 1);
value->type = type;

View file

@ -134,7 +134,7 @@ static void print_creation_free_wrapper(Node *n) {
Printf(s, " swig_object_wrapper *obj = 0;\n");
Printf(s, " if (!object)\n");
Printf(s, " return;\n");
Printf(s, " obj = php_fetch_object(object);\n");
Printf(s, " obj = swig_php_fetch_object(object);\n");
Printf(s, " zend_object_std_dtor(&obj->std);\n");
@ -198,7 +198,7 @@ static void SwigPHP_emit_pointer_type_registrations() {
Append(s_wrappers, "#if PHP_MAJOR_VERSION < 8\n");
Printf(s_wrappers, " swig_object_wrapper *obj = SWIG_Z_FETCH_OBJ_P(z);\n");
Append(s_wrappers, "#else\n");
Printf(s_wrappers, " swig_object_wrapper *obj = php_fetch_object(zobj);\n");
Printf(s_wrappers, " swig_object_wrapper *obj = swig_php_fetch_object(zobj);\n");
Append(s_wrappers, "#endif\n");
Printv(s_wrappers, " sprintf(buf, \"SWIGPointer(%p,owned=%d)\", obj->ptr, obj->newobject);\n", NIL);
Printf(s_wrappers, " ZVAL_STRING(retval, buf);\n");