… | |
… | |
352 | #endif |
352 | #endif |
353 | |
353 | |
354 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
354 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
355 | |
355 | |
356 | static SV * |
356 | static SV * |
357 | newSVptr (void *ptr, HV *stash, HV *hv = newHV ()) |
357 | newSVptr (void *ptr, HV *stash, HV *hv) |
358 | { |
358 | { |
359 | SV *sv; |
359 | SV *sv; |
360 | |
360 | |
361 | if (!ptr) |
361 | if (!ptr) |
362 | return newSV (0); |
362 | return newSV (0); |
363 | |
363 | |
364 | sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, 0, (char *)ptr, 0); |
364 | sv_magicext ((SV *)hv, 0, PERL_MAGIC_ext, 0, (char *)ptr, 0); |
365 | return sv_bless (newRV_noinc ((SV *)hv), stash); |
365 | return sv_bless (newRV_noinc ((SV *)hv), stash); |
|
|
366 | } |
|
|
367 | |
|
|
368 | static SV * |
|
|
369 | newSVptr (void *ptr, HV *stash) |
|
|
370 | { |
|
|
371 | return newSVptr (ptr, stash, newHV ()); |
366 | } |
372 | } |
367 | |
373 | |
368 | static int |
374 | static int |
369 | attachable_free (pTHX_ SV *sv, MAGIC *mg) |
375 | attachable_free (pTHX_ SV *sv, MAGIC *mg) |
370 | { |
376 | { |