1From 7fde4dd4d26d2a4b7957a1010c6ea9e4b940fc62 Mon Sep 17 00:00:00 2001 2From: Stefan Saraev <stefan@saraev.ca> 3Date: Mon, 18 Jan 2021 23:22:52 +0200 4Subject: [PATCH] php8 compat 5 6Upstream: https://github.com/derickr/pecl-dbus/pull/8 7Signed-off-by: Herve Codina <herve.codina@bootlin.com> 8--- 9 dbus.c | 55 ++++++++++++++++++++++++++++++------------------------ 10 php_dbus.h | 10 ++++++++++ 11 2 files changed, 41 insertions(+), 24 deletions(-) 12 13diff --git a/dbus.c b/dbus.c 14index 9fde647..a98e2ea 100644 15--- a/dbus.c 16+++ b/dbus.c 17@@ -38,6 +38,9 @@ 18 #define Z_ADDREF_P(z) ((z)->refcount++) 19 #endif 20 21+ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0) 22+ZEND_END_ARG_INFO() 23+ 24 /* {{{ arginfo */ 25 ZEND_BEGIN_ARG_INFO_EX(arginfo_dbus_object___call, 0, 0, 2) 26 ZEND_ARG_INFO(0, function_name) 27@@ -46,44 +49,44 @@ ZEND_END_ARG_INFO() 28 /* }}} */ 29 30 const zend_function_entry dbus_funcs_dbus[] = { 31- PHP_ME(Dbus, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 32- PHP_ME(Dbus, addWatch, NULL, ZEND_ACC_PUBLIC) 33- PHP_ME(Dbus, waitLoop, NULL, ZEND_ACC_PUBLIC) 34- PHP_ME(Dbus, requestName, NULL, ZEND_ACC_PUBLIC) 35- PHP_ME(Dbus, registerObject, NULL, ZEND_ACC_PUBLIC) 36- PHP_ME(Dbus, createProxy, NULL, ZEND_ACC_PUBLIC) 37+ PHP_ME(Dbus, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 38+ PHP_ME(Dbus, addWatch, arginfo_void, ZEND_ACC_PUBLIC) 39+ PHP_ME(Dbus, waitLoop, arginfo_void, ZEND_ACC_PUBLIC) 40+ PHP_ME(Dbus, requestName, arginfo_void, ZEND_ACC_PUBLIC) 41+ PHP_ME(Dbus, registerObject, arginfo_void, ZEND_ACC_PUBLIC) 42+ PHP_ME(Dbus, createProxy, arginfo_void, ZEND_ACC_PUBLIC) 43 PHP_FE_END 44 }; 45 46 const zend_function_entry dbus_funcs_dbus_object[] = { 47- PHP_ME(DbusObject, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PRIVATE) 48+ PHP_ME(DbusObject, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PRIVATE) 49 PHP_ME(DbusObject, __call, arginfo_dbus_object___call, ZEND_ACC_PUBLIC) 50 PHP_FE_END 51 }; 52 53 const zend_function_entry dbus_funcs_dbus_signal[] = { 54- PHP_ME(DbusSignal, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 55- PHP_ME(DbusSignal, matches, NULL, ZEND_ACC_PUBLIC) 56- PHP_ME(DbusSignal, getData, NULL, ZEND_ACC_PUBLIC) 57- PHP_ME(DbusSignal, send, NULL, ZEND_ACC_PUBLIC) 58+ PHP_ME(DbusSignal, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 59+ PHP_ME(DbusSignal, matches, arginfo_void, ZEND_ACC_PUBLIC) 60+ PHP_ME(DbusSignal, getData, arginfo_void, ZEND_ACC_PUBLIC) 61+ PHP_ME(DbusSignal, send, arginfo_void, ZEND_ACC_PUBLIC) 62 PHP_FE_END 63 }; 64 65 const zend_function_entry dbus_funcs_dbus_array[] = { 66- PHP_ME(DbusArray, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 67- PHP_ME(DbusArray, getData, NULL, ZEND_ACC_PUBLIC) 68+ PHP_ME(DbusArray, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 69+ PHP_ME(DbusArray, getData, arginfo_void, ZEND_ACC_PUBLIC) 70 PHP_FE_END 71 }; 72 73 const zend_function_entry dbus_funcs_dbus_dict[] = { 74- PHP_ME(DbusDict, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 75- PHP_ME(DbusDict, getData, NULL, ZEND_ACC_PUBLIC) 76+ PHP_ME(DbusDict, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 77+ PHP_ME(DbusDict, getData, arginfo_void, ZEND_ACC_PUBLIC) 78 PHP_FE_END 79 }; 80 81 #define PHP_DBUS_INT_WRAPPER_DEF(s,t) \ 82 const zend_function_entry dbus_funcs_dbus_##s[] = { \ 83- PHP_ME(Dbus##t, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) \ 84+ PHP_ME(Dbus##t, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) \ 85 PHP_FE_END \ 86 }; 87 88@@ -98,26 +101,26 @@ PHP_DBUS_INT_WRAPPER_DEF(uint64,UInt64); 89 PHP_DBUS_INT_WRAPPER_DEF(double, Double); 90 91 const zend_function_entry dbus_funcs_dbus_variant[] = { 92- PHP_ME(DbusVariant, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 93- PHP_ME(DbusVariant, getData, NULL, ZEND_ACC_PUBLIC) 94+ PHP_ME(DbusVariant, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 95+ PHP_ME(DbusVariant, getData, arginfo_void, ZEND_ACC_PUBLIC) 96 PHP_FE_END 97 }; 98 99 const zend_function_entry dbus_funcs_dbus_set[] = { 100- PHP_ME(DbusSet, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 101- PHP_ME(DbusSet, getData, NULL, ZEND_ACC_PUBLIC) 102+ PHP_ME(DbusSet, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 103+ PHP_ME(DbusSet, getData, arginfo_void, ZEND_ACC_PUBLIC) 104 PHP_FE_END 105 }; 106 107 const zend_function_entry dbus_funcs_dbus_struct[] = { 108- PHP_ME(DbusStruct, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 109- PHP_ME(DbusStruct, getData, NULL, ZEND_ACC_PUBLIC) 110+ PHP_ME(DbusStruct, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 111+ PHP_ME(DbusStruct, getData, arginfo_void, ZEND_ACC_PUBLIC) 112 PHP_FE_END 113 }; 114 115 const zend_function_entry dbus_funcs_dbus_object_path[] = { 116- PHP_ME(DbusObjectPath, __construct, NULL, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 117- PHP_ME(DbusObjectPath, getData, NULL, ZEND_ACC_PUBLIC) 118+ PHP_ME(DbusObjectPath, __construct, arginfo_void, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC) 119+ PHP_ME(DbusObjectPath, getData, arginfo_void, ZEND_ACC_PUBLIC) 120 PHP_FE_END 121 }; 122 123@@ -405,7 +408,11 @@ static void dbus_register_classes(TSRMLS_D) 124 dbus_ce_dbus = zend_register_internal_class_ex(&ce_dbus, NULL); 125 memcpy(&dbus_object_handlers_dbus, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); 126 dbus_object_handlers_dbus.clone_obj = dbus_object_clone_dbus; 127+#if PHP_VERSION_ID < 80000 128 dbus_object_handlers_dbus.compare_objects = dbus_object_compare_dbus; 129+#else 130+ dbus_object_handlers_dbus.compare = dbus_object_compare_dbus; 131+#endif 132 133 zend_declare_class_constant_long(dbus_ce_dbus, "BYTE", sizeof("BYTE")-1, DBUS_TYPE_BYTE TSRMLS_CC); 134 zend_declare_class_constant_long(dbus_ce_dbus, "BOOLEAN", sizeof("BOOLEAN")-1, DBUS_TYPE_BOOLEAN TSRMLS_CC); 135diff --git a/php_dbus.h b/php_dbus.h 136index 8817544..1f0f551 100644 137--- a/php_dbus.h 138+++ b/php_dbus.h 139@@ -25,6 +25,16 @@ 140 #include "config.h" 141 #endif 142 143+#if PHP_VERSION_ID >= 80000 144+#ifndef TSRMLS_D 145+#define TSRMLS_D void 146+#define TSRMLS_DC 147+#define TSRMLS_C 148+#define TSRMLS_CC 149+#define TSRMLS_FETCH() 150+#endif 151+#endif /* PHP_VERSION_ID >= 80000 */ 152+ 153 #include "Zend/zend_hash.h" 154 155 #define PHP_DBUS_VERSION "0.2.0" 156-- 1572.31.1 158 159