@@ -378,15 +378,94 @@ static const MGVTBL sharedsv_userlock_vtbl = {
378
378
the shared thing.
379
379
*/
380
380
381
- extern const MGVTBL sharedsv_scalar_vtbl ; /* Scalars have this vtable */
382
- extern const MGVTBL sharedsv_array_vtbl ; /* Hashes and arrays have this
383
- - like 'tie' */
384
- extern const MGVTBL sharedsv_elem_vtbl ; /* Elements of hashes and arrays have
385
- this _AS WELL AS_ the scalar magic:
381
+ static int
382
+ sharedsv_scalar_mg_get (pTHX_ SV * sv , MAGIC * mg );
383
+ static int
384
+ sharedsv_scalar_mg_set (pTHX_ SV * sv , MAGIC * mg );
385
+ static int
386
+ sharedsv_scalar_mg_free (pTHX_ SV * sv , MAGIC * mg );
387
+ static int
388
+ sharedsv_scalar_mg_dup (pTHX_ MAGIC * mg , CLONE_PARAMS * param );
389
+ #ifdef MGf_LOCAL
390
+ static int
391
+ sharedsv_scalar_mg_local (pTHX_ SV * nsv , MAGIC * mg );
392
+ #endif
393
+
394
+ static U32
395
+ sharedsv_array_mg_FETCHSIZE (pTHX_ SV * sv , MAGIC * mg );
396
+ static int
397
+ sharedsv_array_mg_CLEAR (pTHX_ SV * sv , MAGIC * mg );
398
+ static int
399
+ sharedsv_array_mg_free (pTHX_ SV * sv , MAGIC * mg );
400
+ #if PERL_VERSION_GE (5 ,11 ,0 )
401
+ static int
402
+ sharedsv_array_mg_copy (pTHX_ SV * sv , MAGIC * mg ,
403
+ SV * nsv , const char * name , I32 namlen );
404
+ #else
405
+ static int
406
+ sharedsv_array_mg_copy (pTHX_ SV * sv , MAGIC * mg ,
407
+ SV * nsv , const char * name , int namlen );
408
+ #endif
409
+ static int
410
+ sharedsv_array_mg_dup (pTHX_ MAGIC * mg , CLONE_PARAMS * param );
411
+
412
+ static int
413
+ sharedsv_elem_mg_FETCH (pTHX_ SV * sv , MAGIC * mg );
414
+ static int
415
+ sharedsv_elem_mg_STORE (pTHX_ SV * sv , MAGIC * mg );
416
+ static int
417
+ sharedsv_elem_mg_DELETE (pTHX_ SV * sv , MAGIC * mg );
418
+ static int
419
+ sharedsv_elem_mg_dup (pTHX_ MAGIC * mg , CLONE_PARAMS * param );
420
+
421
+ /* Scalars have this vtable */
422
+ static const MGVTBL
423
+ sharedsv_scalar_vtbl = {
424
+ sharedsv_scalar_mg_get , /* get */
425
+ sharedsv_scalar_mg_set , /* set */
426
+ 0 , /* len */
427
+ 0 , /* clear */
428
+ sharedsv_scalar_mg_free , /* free */
429
+ 0 , /* copy */
430
+ sharedsv_scalar_mg_dup , /* dup */
431
+ #ifdef MGf_LOCAL
432
+ sharedsv_scalar_mg_local , /* local */
433
+ #endif
434
+ };
435
+
436
+ /* Hashes and arrays have this - like 'tie' */
437
+ static const MGVTBL
438
+ sharedsv_array_vtbl = {
439
+ 0 , /* get */
440
+ 0 , /* set */
441
+ sharedsv_array_mg_FETCHSIZE ,/* len */
442
+ sharedsv_array_mg_CLEAR , /* clear */
443
+ sharedsv_array_mg_free , /* free */
444
+ sharedsv_array_mg_copy , /* copy */
445
+ sharedsv_array_mg_dup , /* dup */
446
+ #ifdef MGf_LOCAL
447
+ 0 , /* local */
448
+ #endif
449
+ };
450
+
451
+ /* Elements of hashes and arrays have
452
+ this _AS WELL AS_ the scalar magic:
386
453
The sharedsv_elem_vtbl associates the element with the array/hash and
387
454
the sharedsv_scalar_vtbl associates it with the value
388
455
*/
389
-
456
+ static const MGVTBL
457
+ sharedsv_elem_vtbl = {
458
+ sharedsv_elem_mg_FETCH , /* get */
459
+ sharedsv_elem_mg_STORE , /* set */
460
+ 0 , /* len */
461
+ sharedsv_elem_mg_DELETE , /* clear */
462
+ 0 , /* free */
463
+ 0 , /* copy */
464
+ sharedsv_elem_mg_dup , /* dup */
465
+ #ifdef MGf_LOCAL
466
+ 0 , /* local */
467
+ #endif
468
+ };
390
469
391
470
/* Get shared aggregate SV pointed to by threads::shared::tie magic object */
392
471
@@ -932,19 +1011,6 @@ sharedsv_scalar_mg_local(pTHX_ SV* nsv, MAGIC *mg)
932
1011
}
933
1012
#endif
934
1013
935
- const MGVTBL sharedsv_scalar_vtbl = {
936
- sharedsv_scalar_mg_get , /* get */
937
- sharedsv_scalar_mg_set , /* set */
938
- 0 , /* len */
939
- 0 , /* clear */
940
- sharedsv_scalar_mg_free , /* free */
941
- 0 , /* copy */
942
- sharedsv_scalar_mg_dup , /* dup */
943
- #ifdef MGf_LOCAL
944
- sharedsv_scalar_mg_local , /* local */
945
- #endif
946
- };
947
-
948
1014
/* ------------ PERL_MAGIC_tiedelem(p) functions -------------- */
949
1015
950
1016
/* Get magic for PERL_MAGIC_tiedelem(p) */
@@ -1093,19 +1159,6 @@ sharedsv_elem_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param)
1093
1159
return (0 );
1094
1160
}
1095
1161
1096
- const MGVTBL sharedsv_elem_vtbl = {
1097
- sharedsv_elem_mg_FETCH , /* get */
1098
- sharedsv_elem_mg_STORE , /* set */
1099
- 0 , /* len */
1100
- sharedsv_elem_mg_DELETE , /* clear */
1101
- 0 , /* free */
1102
- 0 , /* copy */
1103
- sharedsv_elem_mg_dup , /* dup */
1104
- #ifdef MGf_LOCAL
1105
- 0 , /* local */
1106
- #endif
1107
- };
1108
-
1109
1162
/* ------------ PERL_MAGIC_tied(P) functions -------------- */
1110
1163
1111
1164
/* Len magic for PERL_MAGIC_tied(P) */
@@ -1207,19 +1260,6 @@ sharedsv_array_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param)
1207
1260
return (0 );
1208
1261
}
1209
1262
1210
- const MGVTBL sharedsv_array_vtbl = {
1211
- 0 , /* get */
1212
- 0 , /* set */
1213
- sharedsv_array_mg_FETCHSIZE ,/* len */
1214
- sharedsv_array_mg_CLEAR , /* clear */
1215
- sharedsv_array_mg_free , /* free */
1216
- sharedsv_array_mg_copy , /* copy */
1217
- sharedsv_array_mg_dup , /* dup */
1218
- #ifdef MGf_LOCAL
1219
- 0 , /* local */
1220
- #endif
1221
- };
1222
-
1223
1263
1224
1264
/* Recursive locks on a sharedsv.
1225
1265
* Locks are dynamically scoped at the level of the first lock.
0 commit comments