Skip to content

Commit 9b3d1d1

Browse files
committed
remove SINCE74(...) and SINCE80(...) macro fluff
1 parent 6be2206 commit 9b3d1d1

6 files changed

+30
-51
lines changed

v8js_class.cc

+7-13
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static PHP_METHOD(V8Js, __construct)
506506
V8JS_GLOBAL(isolate)->DefineOwnProperty(context, object_name_js, php_obj, v8::ReadOnly);
507507

508508
/* Export public property values */
509-
HashTable *properties = zend_std_get_properties(SINCE80(Z_OBJ_P(getThis()), getThis()));
509+
HashTable *properties = zend_std_get_properties(Z_OBJ_P(getThis()));
510510
zval *value;
511511
zend_string *member;
512512

@@ -1305,13 +1305,10 @@ const zend_function_entry v8js_methods[] = { /* {{{ */
13051305

13061306

13071307
/* V8Js object handlers */
1308-
static SINCE74(zval*, void) v8js_write_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, zval *value, void **cache_slot) /* {{{ */
1308+
static zval* v8js_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
13091309
{
1310-
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
1311-
zend_string *member = SINCE80(_member, Z_STR_P(_member));
1312-
13131310
v8js_ctx *c = Z_V8JS_CTX_OBJ(object);
1314-
V8JS_CTX_PROLOGUE_EX(c, SINCE74(value,));
1311+
V8JS_CTX_PROLOGUE_EX(c, value);
13151312

13161313
/* Check whether member is public, if so, export to V8. */
13171314
zend_property_info *property_info = zend_get_property_info(c->std.ce, member, 1);
@@ -1326,7 +1323,7 @@ static SINCE74(zval*, void) v8js_write_property(SINCE80(zend_object, zval) *_obj
13261323
if (ZSTR_LEN(member) > std::numeric_limits<int>::max()) {
13271324
zend_throw_exception(php_ce_v8js_exception,
13281325
"Property name exceeds maximum supported length", 0);
1329-
return SINCE74(value,);
1326+
return value;
13301327
}
13311328

13321329
/* Write value to PHP JS object */
@@ -1335,15 +1332,12 @@ static SINCE74(zval*, void) v8js_write_property(SINCE80(zend_object, zval) *_obj
13351332
}
13361333

13371334
/* Write value to PHP object */
1338-
SINCE74(return,) std_object_handlers.write_property(SINCE80(object, _object), SINCE80(member, _member), value, NULL);
1335+
return std_object_handlers.write_property(object, member, value, NULL);
13391336
}
13401337
/* }}} */
13411338

1342-
static void v8js_unset_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, void **cache_slot) /* {{{ */
1339+
static void v8js_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
13431340
{
1344-
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
1345-
zend_string *member = SINCE80(_member, Z_STR_P(_member));
1346-
13471341
V8JS_BEGIN_CTX_OBJ(c, object);
13481342
/* Global PHP JS object */
13491343
v8::Local<v8::String> object_name_js = v8::Local<v8::String>::New(isolate, c->object_name);
@@ -1361,7 +1355,7 @@ static void v8js_unset_property(SINCE80(zend_object, zval) *_object, SINCE80(zen
13611355
jsobj->Delete(v8_context, key);
13621356

13631357
/* Unset from PHP object */
1364-
std_object_handlers.unset_property(SINCE80(object, _object), SINCE80(member, _member), NULL);
1358+
std_object_handlers.unset_property(object, member, NULL);
13651359
}
13661360
/* }}} */
13671361

v8js_convert.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ v8::Local<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */
133133
ce = php_date_get_date_ce();
134134
if (instanceof_function(Z_OBJCE_P(value), ce)) {
135135
zval dtval;
136-
zend_call_method_with_0_params(SINCE80(Z_OBJ_P(value), value), NULL, NULL, "getTimestamp", &dtval);
136+
zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "getTimestamp", &dtval);
137137
v8::Date::New(isolate->GetEnteredOrMicrotaskContext(), ((double)Z_LVAL(dtval) * 1000.0)).ToLocal(&jsValue);
138138
zval_dtor(&dtval);
139139
} else

v8js_exceptions.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::
5151
object_init_ex(return_value, php_ce_v8js_script_exception);
5252

5353
#define PHPV8_EXPROP(type, name, value) \
54-
zend_update_property##type(php_ce_v8js_script_exception, SINCE80(Z_OBJ_P(return_value), return_value), #name, sizeof(#name) - 1, value);
54+
zend_update_property##type(php_ce_v8js_script_exception, Z_OBJ_P(return_value), #name, sizeof(#name) - 1, value);
5555

5656

5757
if (tc_message.IsEmpty()) {
@@ -137,7 +137,7 @@ void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch)
137137
if (zend_parse_parameters_none() == FAILURE) { \
138138
return; \
139139
} \
140-
value = zend_read_property(php_ce_v8js_script_exception, SINCE80(Z_OBJ_P(getThis()), getThis()), #property, sizeof(#property) - 1, 0, &rv); \
140+
value = zend_read_property(php_ce_v8js_script_exception, Z_OBJ_P(getThis()), #property, sizeof(#property) - 1, 0, &rv); \
141141
RETURN_ZVAL(value, 1, 0); \
142142
}
143143

v8js_object_export.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
787787
const zend_object_handlers *h = object->handlers;
788788

789789
if (callback_type == V8JS_PROP_QUERY) {
790-
if (h->has_property(&zobject, SINCE80(Z_STR_P(&zname), &zname), 0, NULL)) {
790+
if (h->has_property(&zobject, Z_STR_P(&zname), 0, NULL)) {
791791
ret_value = V8JS_UINT(v8::None);
792792
} else {
793793
ret_value = v8::Local<v8::Value>(); // empty handle
@@ -798,7 +798,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
798798
if(!property_info ||
799799
(property_info != ZEND_WRONG_PROPERTY_INFO &&
800800
property_info->flags & ZEND_ACC_PUBLIC)) {
801-
h->unset_property(&zobject, SINCE80(Z_STR_P(&zname), &zname), NULL);
801+
h->unset_property(&zobject, Z_STR_P(&zname), NULL);
802802
ret_value = V8JS_TRUE();
803803
}
804804
else {

v8js_v8.h

-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,6 @@ int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, in
8888
V8JS_CTX_PROLOGUE(ctx);
8989

9090

91-
#define SINCE74(x,y) x
92-
#define SINCE80(x,y) x
93-
9491
// polyfill for ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX, which changes between 7.1 and 7.2
9592
#define V8_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
9693
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null)

v8js_v8object_class.cc

+18-30
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ static zend_object_handlers v8js_v8generator_handlers;
4545
#define V8JS_V8_INVOKE_FUNC_NAME "V8Js::V8::Invoke"
4646

4747
/* V8 Object handlers */
48-
static int v8js_v8object_has_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, int has_set_exists, void **cache_slot) /* {{{ */
48+
static int v8js_v8object_has_property(zend_object *object, zend_string *member, int has_set_exists, void **cache_slot) /* {{{ */
4949
{
50-
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
51-
zend_string *member = SINCE80(_member, Z_STR_P(_member));
5250
/* param has_set_exists:
5351
* 0 (has) whether property exists and is not NULL - isset()
5452
* 1 (set) whether property exists and is true-ish - empty()
@@ -128,19 +126,16 @@ static int v8js_v8object_has_property(SINCE80(zend_object, zval) *_object, SINCE
128126
}
129127
/* }}} */
130128

131-
static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, int type, void **cache_slot, zval *rv) /* {{{ */
129+
static zval *v8js_v8object_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) /* {{{ */
132130
{
133-
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
134-
zend_string *member = SINCE80(_member, Z_STR_P(_member));
135-
136131
zval *retval = rv;
137132
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
138133

139134
if (!obj->ctx)
140135
{
141136
zend_throw_exception(php_ce_v8js_exception,
142137
"Can't access V8Object after V8Js instance is destroyed!", 0);
143-
return SINCE80(&EG(uninitialized_zval), retval);
138+
return &EG(uninitialized_zval);
144139
}
145140

146141
V8JS_CTX_PROLOGUE_EX(obj->ctx, retval);
@@ -152,7 +147,7 @@ static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SI
152147
{
153148
zend_throw_exception(php_ce_v8js_exception,
154149
"Member name length exceeds maximum supported length", 0);
155-
return SINCE80(&EG(uninitialized_zval), retval);
150+
return &EG(uninitialized_zval);
156151
}
157152

158153
v8::Local<v8::String> jsKey = V8JS_ZSYM(member);
@@ -174,34 +169,31 @@ static zval *v8js_v8object_read_property(SINCE80(zend_object, zval) *_object, SI
174169
}
175170
/* }}} */
176171

177-
static zval *v8js_v8object_get_property_ptr_ptr(SINCE80(zend_object, zval) *object, SINCE80(zend_string, zval) *member, int type, void **cache_slot) /* {{{ */
172+
static zval *v8js_v8object_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) /* {{{ */
178173
{
179174
return NULL;
180175
}
181176
/* }}} */
182177

183-
static SINCE74(zval *, void) v8js_v8object_write_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, zval *value, void **cache_slot) /* {{{ */
178+
static zval *v8js_v8object_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
184179
{
185-
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
186-
zend_string *member = SINCE80(_member, Z_STR_P(_member));
187-
188180
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
189181

190182
if (!obj->ctx)
191183
{
192184
zend_throw_exception(php_ce_v8js_exception,
193185
"Can't access V8Object after V8Js instance is destroyed!", 0);
194-
return SINCE74(value, );
186+
return value;
195187
}
196188

197-
V8JS_CTX_PROLOGUE_EX(obj->ctx, SINCE74(value, ));
189+
V8JS_CTX_PROLOGUE_EX(obj->ctx, value);
198190
v8::Local<v8::Value> v8objHandle = v8::Local<v8::Value>::New(isolate, obj->v8obj);
199191

200192
if (ZSTR_LEN(member) > std::numeric_limits<int>::max())
201193
{
202194
zend_throw_exception(php_ce_v8js_exception,
203195
"Member name length exceeds maximum supported length", 0);
204-
return SINCE74(value, );
196+
return value;
205197
}
206198

207199
v8::Local<v8::Object> v8obj;
@@ -210,15 +202,12 @@ static SINCE74(zval *, void) v8js_v8object_write_property(SINCE80(zend_object, z
210202
v8obj->CreateDataProperty(v8_context, V8JS_ZSYM(member), zval_to_v8js(value, isolate));
211203
}
212204

213-
return SINCE74(value, );
205+
return value;
214206
}
215207
/* }}} */
216208

217-
static void v8js_v8object_unset_property(SINCE80(zend_object, zval) *_object, SINCE80(zend_string, zval) *_member, void **cache_slot) /* {{{ */
209+
static void v8js_v8object_unset_property(zend_object *object, zend_string *member, void **cache_slot) /* {{{ */
218210
{
219-
zend_object *object = SINCE80(_object, Z_OBJ_P(_object));
220-
zend_string *member = SINCE80(_member, Z_STR_P(_member));
221-
222211
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
223212

224213
if (!obj->ctx)
@@ -246,9 +235,9 @@ static void v8js_v8object_unset_property(SINCE80(zend_object, zval) *_object, SI
246235
}
247236
/* }}} */
248237

249-
static HashTable *v8js_v8object_get_properties(SINCE80(zend_object, zval) *object) /* {{{ */
238+
static HashTable *v8js_v8object_get_properties(zend_object *object) /* {{{ */
250239
{
251-
v8js_v8object *obj = SINCE80(Z_V8JS_V8OBJECT_OBJ, Z_V8JS_V8OBJECT_OBJ_P)(object);
240+
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
252241

253242
if (obj->properties == NULL)
254243
{
@@ -287,7 +276,7 @@ static HashTable *v8js_v8object_get_properties(SINCE80(zend_object, zval) *objec
287276
}
288277
/* }}} */
289278

290-
static HashTable *v8js_v8object_get_debug_info(SINCE80(zend_object, zval) *object, int *is_temp) /* {{{ */
279+
static HashTable *v8js_v8object_get_debug_info(zend_object *object, int *is_temp) /* {{{ */
291280
{
292281
*is_temp = 0;
293282
return v8js_v8object_get_properties(object);
@@ -426,7 +415,7 @@ static ZEND_FUNCTION(zend_v8object_func)
426415
static zend_function *v8js_v8object_get_method(zend_object **object_ptr, zend_string *method, const zval *key) /* {{{ */
427416
{
428417
v8js_v8object *obj = v8js_v8object_fetch_object(*object_ptr);
429-
SINCE80(zend_internal_function, zend_function) *f;
418+
zend_internal_function *f;
430419

431420
if (!obj->ctx)
432421
{
@@ -581,8 +570,8 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I
581570

582571
static int v8js_v8object_get_closure(zend_object *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr, bool call) /* {{{ */
583572
{
584-
SINCE80(zend_internal_function, zend_function) *invoke;
585-
v8js_v8object *obj = SINCE80(Z_V8JS_V8OBJECT_OBJ, Z_V8JS_V8OBJECT_OBJ_P)(object);
573+
zend_internal_function *invoke;
574+
v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ(object);
586575

587576
if (!obj->ctx)
588577
{
@@ -609,7 +598,7 @@ static int v8js_v8object_get_closure(zend_object *object, zend_class_entry **ce_
609598

610599
if (zobj_ptr)
611600
{
612-
*zobj_ptr = SINCE80(object, Z_OBJ_P(object));
601+
*zobj_ptr = object;
613602
}
614603

615604
*ce_ptr = NULL;
@@ -1034,7 +1023,6 @@ PHP_MINIT_FUNCTION(v8js_v8object_class) /* {{{ */
10341023
v8js_v8object_handlers.unset_property = v8js_v8object_unset_property;
10351024
v8js_v8object_handlers.get_properties = v8js_v8object_get_properties;
10361025
v8js_v8object_handlers.get_method = v8js_v8object_get_method;
1037-
SINCE80(, v8js_v8object_handlers.call_method = v8js_v8object_call_method);
10381026
v8js_v8object_handlers.get_debug_info = v8js_v8object_get_debug_info;
10391027
v8js_v8object_handlers.get_closure = v8js_v8object_get_closure;
10401028
v8js_v8object_handlers.offset = XtOffsetOf(struct v8js_v8object, std);

0 commit comments

Comments
 (0)