@@ -158,6 +158,25 @@ static int zend_file_cache_flock(int fd, int type)
158
158
} \
159
159
} while (0 )
160
160
161
+ #define SERIALIZE_ATTRIBUTES (attr ) do { \
162
+ if ((attr) && !IS_SERIALIZED(attr)) { \
163
+ HashTable *ht; \
164
+ SERIALIZE_PTR(attr); \
165
+ ht = (attr); \
166
+ UNSERIALIZE_PTR(ht); \
167
+ zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval); \
168
+ } \
169
+ } while (0)
170
+
171
+ #define UNSERIALIZE_ATTRIBUTES (attr ) do { \
172
+ if ((attr) && !IS_UNSERIALIZED(attr)) { \
173
+ HashTable *ht; \
174
+ UNSERIALIZE_PTR(attr); \
175
+ ht = (attr); \
176
+ zend_file_cache_unserialize_hash(ht, script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR); \
177
+ } \
178
+ } while (0)
179
+
161
180
static const uint32_t uninitialized_bucket [- HT_MIN_MASK ] =
162
181
{HT_INVALID_IDX , HT_INVALID_IDX };
163
182
@@ -421,14 +440,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
421
440
SERIALIZE_PTR (op_array -> live_range );
422
441
SERIALIZE_PTR (op_array -> scope );
423
442
SERIALIZE_STR (op_array -> doc_comment );
424
- if (op_array -> attributes && !IS_SERIALIZED (op_array -> attributes )) {
425
- HashTable * ht ;
426
-
427
- SERIALIZE_PTR (op_array -> attributes );
428
- ht = op_array -> attributes ;
429
- UNSERIALIZE_PTR (ht );
430
- zend_file_cache_serialize_hash (ht , script , info , buf , zend_file_cache_serialize_zval );
431
- }
443
+ SERIALIZE_ATTRIBUTES (op_array -> attributes );
432
444
SERIALIZE_PTR (op_array -> try_catch_array );
433
445
SERIALIZE_PTR (op_array -> prototype );
434
446
return ;
@@ -555,6 +567,7 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
555
567
SERIALIZE_PTR (op_array -> live_range );
556
568
SERIALIZE_PTR (op_array -> scope );
557
569
SERIALIZE_STR (op_array -> doc_comment );
570
+ SERIALIZE_ATTRIBUTES (op_array -> attributes );
558
571
SERIALIZE_PTR (op_array -> try_catch_array );
559
572
SERIALIZE_PTR (op_array -> prototype );
560
573
@@ -599,15 +612,7 @@ static void zend_file_cache_serialize_prop_info(zval *zv,
599
612
if (prop -> doc_comment ) {
600
613
SERIALIZE_STR (prop -> doc_comment );
601
614
}
602
-
603
- if (prop -> attributes ) {
604
- HashTable * ht ;
605
-
606
- SERIALIZE_PTR (prop -> attributes );
607
- ht = prop -> attributes ;
608
- UNSERIALIZE_PTR (ht );
609
- zend_file_cache_serialize_hash (ht , script , info , buf , zend_file_cache_serialize_zval );
610
- }
615
+ SERIALIZE_ATTRIBUTES (prop -> attributes );
611
616
612
617
zend_file_cache_serialize_type (& prop -> type , script , info , buf );
613
618
}
@@ -636,14 +641,7 @@ static void zend_file_cache_serialize_class_constant(zval *z
636
641
SERIALIZE_STR (c -> doc_comment );
637
642
}
638
643
639
- if (c -> attributes ) {
640
- HashTable * ht ;
641
-
642
- SERIALIZE_PTR (c -> attributes );
643
- ht = c -> attributes ;
644
- UNSERIALIZE_PTR (ht );
645
- zend_file_cache_serialize_hash (ht , script , info , buf , zend_file_cache_serialize_zval );
646
- }
644
+ SERIALIZE_ATTRIBUTES (c -> attributes );
647
645
}
648
646
}
649
647
}
@@ -701,14 +699,7 @@ static void zend_file_cache_serialize_class(zval *zv,
701
699
zend_file_cache_serialize_hash (& ce -> constants_table , script , info , buf , zend_file_cache_serialize_class_constant );
702
700
SERIALIZE_STR (ce -> info .user .filename );
703
701
SERIALIZE_STR (ce -> info .user .doc_comment );
704
- if (ce -> info .user .attributes && !IS_SERIALIZED (ce -> info .user .attributes )) {
705
- HashTable * ht ;
706
-
707
- SERIALIZE_PTR (ce -> info .user .attributes );
708
- ht = ce -> info .user .attributes ;
709
- UNSERIALIZE_PTR (ht );
710
- zend_file_cache_serialize_hash (ht , script , info , buf , zend_file_cache_serialize_zval );
711
- }
702
+ SERIALIZE_ATTRIBUTES (ce -> info .user .attributes );
712
703
zend_file_cache_serialize_hash (& ce -> properties_info , script , info , buf , zend_file_cache_serialize_prop_info );
713
704
714
705
if (ce -> properties_info_table ) {
@@ -1174,6 +1165,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
1174
1165
UNSERIALIZE_PTR (op_array -> live_range );
1175
1166
UNSERIALIZE_PTR (op_array -> scope );
1176
1167
UNSERIALIZE_STR (op_array -> doc_comment );
1168
+ UNSERIALIZE_ATTRIBUTES (op_array -> attributes );
1177
1169
UNSERIALIZE_PTR (op_array -> try_catch_array );
1178
1170
UNSERIALIZE_PTR (op_array -> prototype );
1179
1171
return ;
@@ -1289,14 +1281,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
1289
1281
UNSERIALIZE_PTR (op_array -> live_range );
1290
1282
UNSERIALIZE_PTR (op_array -> scope );
1291
1283
UNSERIALIZE_STR (op_array -> doc_comment );
1292
- if (op_array -> attributes && !IS_UNSERIALIZED (op_array -> attributes )) {
1293
- HashTable * ht ;
1294
-
1295
- UNSERIALIZE_PTR (op_array -> attributes );
1296
- ht = op_array -> attributes ;
1297
- zend_file_cache_unserialize_hash (ht ,
1298
- script , buf , zend_file_cache_unserialize_zval , ZVAL_PTR_DTOR );
1299
- }
1284
+ UNSERIALIZE_ATTRIBUTES (op_array -> attributes );
1300
1285
UNSERIALIZE_PTR (op_array -> try_catch_array );
1301
1286
UNSERIALIZE_PTR (op_array -> prototype );
1302
1287
@@ -1350,14 +1335,7 @@ static void zend_file_cache_unserialize_prop_info(zval *zv,
1350
1335
if (prop -> doc_comment ) {
1351
1336
UNSERIALIZE_STR (prop -> doc_comment );
1352
1337
}
1353
- if (prop -> attributes && !IS_UNSERIALIZED (prop -> attributes )) {
1354
- HashTable * ht ;
1355
-
1356
- UNSERIALIZE_PTR (prop -> attributes );
1357
- ht = prop -> attributes ;
1358
- zend_file_cache_unserialize_hash (ht ,
1359
- script , buf , zend_file_cache_unserialize_zval , ZVAL_PTR_DTOR );
1360
- }
1338
+ UNSERIALIZE_ATTRIBUTES (prop -> attributes );
1361
1339
zend_file_cache_unserialize_type (& prop -> type , script , buf );
1362
1340
}
1363
1341
}
@@ -1382,14 +1360,7 @@ static void zend_file_cache_unserialize_class_constant(zval *
1382
1360
if (c -> doc_comment ) {
1383
1361
UNSERIALIZE_STR (c -> doc_comment );
1384
1362
}
1385
- if (c -> attributes && !IS_UNSERIALIZED (c -> attributes )) {
1386
- HashTable * ht ;
1387
-
1388
- UNSERIALIZE_PTR (c -> attributes );
1389
- ht = c -> attributes ;
1390
- zend_file_cache_unserialize_hash (ht ,
1391
- script , buf , zend_file_cache_unserialize_zval , ZVAL_PTR_DTOR );
1392
- }
1363
+ UNSERIALIZE_ATTRIBUTES (c -> attributes );
1393
1364
}
1394
1365
}
1395
1366
}
@@ -1444,14 +1415,7 @@ static void zend_file_cache_unserialize_class(zval *zv,
1444
1415
script , buf , zend_file_cache_unserialize_class_constant , NULL );
1445
1416
UNSERIALIZE_STR (ce -> info .user .filename );
1446
1417
UNSERIALIZE_STR (ce -> info .user .doc_comment );
1447
- if (ce -> info .user .attributes && !IS_UNSERIALIZED (ce -> info .user .attributes )) {
1448
- HashTable * ht ;
1449
-
1450
- UNSERIALIZE_PTR (ce -> info .user .attributes );
1451
- ht = ce -> info .user .attributes ;
1452
- zend_file_cache_unserialize_hash (ht ,
1453
- script , buf , zend_file_cache_unserialize_zval , ZVAL_PTR_DTOR );
1454
- }
1418
+ UNSERIALIZE_ATTRIBUTES (ce -> info .user .attributes );
1455
1419
zend_file_cache_unserialize_hash (& ce -> properties_info ,
1456
1420
script , buf , zend_file_cache_unserialize_prop_info , NULL );
1457
1421
0 commit comments