diff options
author | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-02-28 16:49:33 -0800 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-02-28 16:49:33 -0800 |
commit | a5f75d667838e8e7bb037880391f5c44476d33b4 (patch) | |
tree | 5005e888355c1508bc47da697efe119c1615b123 /ext/Safe | |
parent | 2920c5d2b358b11ace52104b6944bfa0e89256a7 (diff) | |
download | perl-a5f75d667838e8e7bb037880391f5c44476d33b4.tar.gz |
perl 5.002perl-5.002
[editor's note: changes seem to be mostly module updates,
documentation changes and some perl API macro additions]
Diffstat (limited to 'ext/Safe')
-rw-r--r-- | ext/Safe/Safe.xs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/ext/Safe/Safe.xs b/ext/Safe/Safe.xs index f970a626ac..6b25924a33 100644 --- a/ext/Safe/Safe.xs +++ b/ext/Safe/Safe.xs @@ -2,6 +2,9 @@ #include "perl.h" #include "XSUB.h" +/* maxo should never differ from MAXO but leave some room anyway */ +#define OP_MASK_BUF_SIZE (MAXO + 100) + MODULE = Safe PACKAGE = Safe void @@ -13,14 +16,15 @@ safe_call_sv(package, mask, codesv) int i; char *str; STRLEN len; + char op_mask_buf[OP_MASK_BUF_SIZE]; + assert(maxo < OP_MASK_BUF_SIZE); ENTER; SAVETMPS; save_hptr(&defstash); save_aptr(&endav); SAVEPPTR(op_mask); - Newz(666, op_mask, maxo+1, char); - SAVEFREEPV(op_mask); + op_mask = &op_mask_buf[0]; str = SvPV(mask, len); if (maxo != len) croak("Bad mask length"); @@ -62,8 +66,8 @@ void ops_to_mask(...) CODE: int i, j; - char *mask, *op; - Newz(666, mask, maxo+1, char); + char mask[OP_MASK_BUF_SIZE], *op; + Zero(mask, sizeof mask, char); for (i = 0; i < items; i++) { op = SvPV(ST(i), na); @@ -76,8 +80,7 @@ ops_to_mask(...) croak("bad op name \"%s\" in mask", op); } } - ST(0) = sv_newmortal(); - sv_usepvn(ST(0), mask, maxo); + ST(0) = sv_2mortal(newSVpv(mask,maxo)); void opname(...) |