Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

reduce code duplication in the CLONE method and make sure to dup the …

…handles object when CLONEing
  • Loading branch information...
commit bb8b2a5400cbea249e1172f143e6c9c80aa9fc07 1 parent e3be4c1
@frett frett authored
Showing with 19 additions and 18 deletions.
  1. +19 −18 Fuse.xs
View
37 Fuse.xs
@@ -969,33 +969,34 @@ CLONE(...)
MY_CXT_CLONE;
tTHX parent = MY_CXT.self;
MY_CXT.self = my_perl;
-#if (PERL_VERSION > 13) || (PERL_VERSION == 13 && PERL_SUBVERSION >= 2)
- CLONE_PARAMS *clone_param = clone_params_new(parent, aTHX);
- for(i=0;i<N_CALLBACKS;i++) {
- if(MY_CXT.callback[i]) {
- MY_CXT.callback[i] = sv_dup(MY_CXT.callback[i], clone_param);
- }
- }
- clone_params_del(clone_param);
-#else
-# if (PERL_VERSION < 10) || (PERL_VERSION == 10 && PERL_SUBVERSION <= 0)
- // CLONE entered without a pointer table, so we can't safely clone static data
+#if (PERL_VERSION < 10) || (PERL_VERSION == 10 && PERL_SUBVERSION <= 0)
+ /* CLONE entered without a pointer table, so we can't safely clone static data */
if(!PL_ptr_table) {
for(i=0;i<N_CALLBACKS;i++) {
MY_CXT.callback[i] = NULL;
}
+ MY_CXT.handles = newHV();
} else
-# endif
+#endif
{
- CLONE_PARAMS clone_param;
- clone_param.flags = 0;
+ CLONE_PARAMS *clone_param;
+#if (PERL_VERSION > 13) || (PERL_VERSION == 13 && PERL_SUBVERSION >= 2)
+ clone_param = clone_params_new(parent, aTHX);
+#else
+ CLONE_PARAMS raw_param;
+ raw_param.flags = 0;
+ raw_param.proto_perl = parent;
+ raw_param.stashes = (AV*)sv_2mortal((SV*)newAV());
+ clone_param = &raw_param;
+#endif
for(i=0;i<N_CALLBACKS;i++) {
- if(MY_CXT.callback[i]) {
- MY_CXT.callback[i] = sv_dup(MY_CXT.callback[i], &clone_param);
- }
+ MY_CXT.callback[i] = sv_dup(MY_CXT.callback[i], clone_param);
}
- }
+ MY_CXT.handles = (HV*)sv_dup((SV*)MY_CXT.handles, clone_param);
+#if (PERL_VERSION > 13) || (PERL_VERSION == 13 && PERL_SUBVERSION >= 2)
+ clone_params_del(clone_param);
#endif
+ }
SV*
fuse_get_context()
Please sign in to comment.
Something went wrong with that request. Please try again.