@@ -377,15 +377,94 @@ static const MGVTBL sharedsv_userlock_vtbl = {
377377 the shared thing.
378378 */
379379
380- extern const MGVTBL sharedsv_scalar_vtbl ; /* Scalars have this vtable */
381- extern const MGVTBL sharedsv_array_vtbl ; /* Hashes and arrays have this
382- - like 'tie' */
383- extern const MGVTBL sharedsv_elem_vtbl ; /* Elements of hashes and arrays have
384- this _AS WELL AS_ the scalar magic:
380+ static int
381+ sharedsv_scalar_mg_get (pTHX_ SV * sv , MAGIC * mg );
382+ static int
383+ sharedsv_scalar_mg_set (pTHX_ SV * sv , MAGIC * mg );
384+ static int
385+ sharedsv_scalar_mg_free (pTHX_ SV * sv , MAGIC * mg );
386+ static int
387+ sharedsv_scalar_mg_dup (pTHX_ MAGIC * mg , CLONE_PARAMS * param );
388+ #ifdef MGf_LOCAL
389+ static int
390+ sharedsv_scalar_mg_local (pTHX_ SV * nsv , MAGIC * mg );
391+ #endif
392+
393+ static U32
394+ sharedsv_array_mg_FETCHSIZE (pTHX_ SV * sv , MAGIC * mg );
395+ static int
396+ sharedsv_array_mg_CLEAR (pTHX_ SV * sv , MAGIC * mg );
397+ static int
398+ sharedsv_array_mg_free (pTHX_ SV * sv , MAGIC * mg );
399+ #if PERL_VERSION_GE (5 ,11 ,0 )
400+ static int
401+ sharedsv_array_mg_copy (pTHX_ SV * sv , MAGIC * mg ,
402+ SV * nsv , const char * name , I32 namlen );
403+ #else
404+ static int
405+ sharedsv_array_mg_copy (pTHX_ SV * sv , MAGIC * mg ,
406+ SV * nsv , const char * name , int namlen );
407+ #endif
408+ static int
409+ sharedsv_array_mg_dup (pTHX_ MAGIC * mg , CLONE_PARAMS * param );
410+
411+ static int
412+ sharedsv_elem_mg_FETCH (pTHX_ SV * sv , MAGIC * mg );
413+ static int
414+ sharedsv_elem_mg_STORE (pTHX_ SV * sv , MAGIC * mg );
415+ static int
416+ sharedsv_elem_mg_DELETE (pTHX_ SV * sv , MAGIC * mg );
417+ static int
418+ sharedsv_elem_mg_dup (pTHX_ MAGIC * mg , CLONE_PARAMS * param );
419+
420+ /* Scalars have this vtable */
421+ static const MGVTBL
422+ sharedsv_scalar_vtbl = {
423+ sharedsv_scalar_mg_get , /* get */
424+ sharedsv_scalar_mg_set , /* set */
425+ 0 , /* len */
426+ 0 , /* clear */
427+ sharedsv_scalar_mg_free , /* free */
428+ 0 , /* copy */
429+ sharedsv_scalar_mg_dup , /* dup */
430+ #ifdef MGf_LOCAL
431+ sharedsv_scalar_mg_local , /* local */
432+ #endif
433+ };
434+
435+ /* Hashes and arrays have this - like 'tie' */
436+ static const MGVTBL
437+ sharedsv_array_vtbl = {
438+ 0 , /* get */
439+ 0 , /* set */
440+ sharedsv_array_mg_FETCHSIZE ,/* len */
441+ sharedsv_array_mg_CLEAR , /* clear */
442+ sharedsv_array_mg_free , /* free */
443+ sharedsv_array_mg_copy , /* copy */
444+ sharedsv_array_mg_dup , /* dup */
445+ #ifdef MGf_LOCAL
446+ 0 , /* local */
447+ #endif
448+ };
449+
450+ /* Elements of hashes and arrays have
451+ this _AS WELL AS_ the scalar magic:
385452 The sharedsv_elem_vtbl associates the element with the array/hash and
386453 the sharedsv_scalar_vtbl associates it with the value
387454 */
388-
455+ static const MGVTBL
456+ sharedsv_elem_vtbl = {
457+ sharedsv_elem_mg_FETCH , /* get */
458+ sharedsv_elem_mg_STORE , /* set */
459+ 0 , /* len */
460+ sharedsv_elem_mg_DELETE , /* clear */
461+ 0 , /* free */
462+ 0 , /* copy */
463+ sharedsv_elem_mg_dup , /* dup */
464+ #ifdef MGf_LOCAL
465+ 0 , /* local */
466+ #endif
467+ };
389468
390469/* Get shared aggregate SV pointed to by threads::shared::tie magic object */
391470
@@ -931,19 +1010,6 @@ sharedsv_scalar_mg_local(pTHX_ SV* nsv, MAGIC *mg)
9311010}
9321011#endif
9331012
934- const MGVTBL sharedsv_scalar_vtbl = {
935- sharedsv_scalar_mg_get , /* get */
936- sharedsv_scalar_mg_set , /* set */
937- 0 , /* len */
938- 0 , /* clear */
939- sharedsv_scalar_mg_free , /* free */
940- 0 , /* copy */
941- sharedsv_scalar_mg_dup , /* dup */
942- #ifdef MGf_LOCAL
943- sharedsv_scalar_mg_local , /* local */
944- #endif
945- };
946-
9471013/* ------------ PERL_MAGIC_tiedelem(p) functions -------------- */
9481014
9491015/* Get magic for PERL_MAGIC_tiedelem(p) */
@@ -1092,19 +1158,6 @@ sharedsv_elem_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param)
10921158 return (0 );
10931159}
10941160
1095- const MGVTBL sharedsv_elem_vtbl = {
1096- sharedsv_elem_mg_FETCH , /* get */
1097- sharedsv_elem_mg_STORE , /* set */
1098- 0 , /* len */
1099- sharedsv_elem_mg_DELETE , /* clear */
1100- 0 , /* free */
1101- 0 , /* copy */
1102- sharedsv_elem_mg_dup , /* dup */
1103- #ifdef MGf_LOCAL
1104- 0 , /* local */
1105- #endif
1106- };
1107-
11081161/* ------------ PERL_MAGIC_tied(P) functions -------------- */
11091162
11101163/* Len magic for PERL_MAGIC_tied(P) */
@@ -1206,19 +1259,6 @@ sharedsv_array_mg_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param)
12061259 return (0 );
12071260}
12081261
1209- const MGVTBL sharedsv_array_vtbl = {
1210- 0 , /* get */
1211- 0 , /* set */
1212- sharedsv_array_mg_FETCHSIZE ,/* len */
1213- sharedsv_array_mg_CLEAR , /* clear */
1214- sharedsv_array_mg_free , /* free */
1215- sharedsv_array_mg_copy , /* copy */
1216- sharedsv_array_mg_dup , /* dup */
1217- #ifdef MGf_LOCAL
1218- 0 , /* local */
1219- #endif
1220- };
1221-
12221262
12231263/* Recursive locks on a sharedsv.
12241264 * Locks are dynamically scoped at the level of the first lock.
0 commit comments