~ubuntu-branches/ubuntu/wily/libclone-perl/wily-proposed

« back to all changes in this revision

Viewing changes to Clone.xs

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2005-07-21 14:10:27 UTC
  • mfrom: (0.2.1 upstream) (1.1.1 breezy)
  • Revision ID: james.westby@ubuntu.com-20050721141027-70fbyjfg0ce32rdr
Tags: 0.18-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#include "perl.h"
5
5
#include "XSUB.h"
6
6
 
7
 
static char *rcs_id = "$Id: Clone.xs,v 0.15 2003/09/07 22:02:35 ray Exp $";
 
7
static char *rcs_id = "$Id: Clone.xs,v 0.18 2005/05/23 15:34:31 ray Exp $";
8
8
 
9
9
#define CLONE_KEY(x) ((char *) x) 
10
10
 
124
124
  SV *clone = ref;
125
125
  SV **seen = NULL;
126
126
  UV visible = (SvREFCNT(ref) > 1);
 
127
  int magic_ref = 0;
127
128
 
128
129
  TRACEME(("ref = 0x%x(%d)\n", ref, SvREFCNT(ref)));
129
130
 
225
226
        SV *obj;
226
227
        /* we don't want to clone a qr (regexp) object */
227
228
        /* there are probably other types as well ...  */
228
 
        if (mg->mg_type == 'r')
 
229
        if (mg->mg_type == 'r')
229
230
          obj = mg->mg_obj; 
 
231
        else if (mg->mg_type == '<') /* PERL_MAGIC_backref */
 
232
          continue; 
230
233
        else
231
234
          obj = sv_clone(mg->mg_obj, -1); 
 
235
        magic_ref++;
232
236
        /* this is plain old magic, so do the same thing */
233
237
        sv_magic(clone, 
234
238
                 obj,
241
245
        mg->mg_virtual = (MGVTBL *) NULL;
242
246
    }
243
247
    /* 2: HASH/ARRAY  - (with 'internal' elements) */
 
248
  if ( magic_ref )
 
249
  {
 
250
    ;;
 
251
  }
244
252
  else if ( SvTYPE(ref) == SVt_PVHV )
245
253
    clone = hv_clone (ref, clone, depth);
246
254
  else if ( SvTYPE(ref) == SVt_PVAV )