Skip to content

Commit

Permalink
[rt #69243] simplify XS for i_new_fill_hatchf?() and handle magic
Browse files Browse the repository at this point in the history
The code checked SvOK() without calling SvGETMAGIC()
  • Loading branch information
tonycoz committed May 24, 2013
1 parent f4aca83 commit a309fbc
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Imager.xs
Expand Up @@ -3818,19 +3818,21 @@ i_new_fill_solidf(cl, combine)
int combine

Imager::FillHandle
i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch_sv, dx, dy)
Imager::Color fg
Imager::Color bg
int combine
int hatch
SV *cust_hatch_sv
i_img_dim dx
i_img_dim dy
PREINIT:
unsigned char *cust_hatch;
STRLEN len;
CODE:
if (SvOK(ST(4))) {
cust_hatch = (unsigned char *)SvPV(ST(4), len);
SvGETMAGIC(cust_hatch_sv);
if (SvOK(cust_hatch_sv)) {
cust_hatch = (unsigned char *)SvPV_nomg(cust_hatch_sv, len);
}
else
cust_hatch = NULL;
Expand All @@ -3839,19 +3841,21 @@ i_new_fill_hatch(fg, bg, combine, hatch, cust_hatch, dx, dy)
RETVAL

Imager::FillHandle
i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch, dx, dy)
i_new_fill_hatchf(fg, bg, combine, hatch, cust_hatch_sv, dx, dy)
Imager::Color::Float fg
Imager::Color::Float bg
int combine
int hatch
SV *cust_hatch_sv
i_img_dim dx
i_img_dim dy
PREINIT:
unsigned char *cust_hatch;
STRLEN len;
CODE:
if (SvOK(ST(4))) {
cust_hatch = (unsigned char *)SvPV(ST(4), len);
SvGETMAGIC(cust_hatch_sv);
if (SvOK(cust_hatch_sv)) {
cust_hatch = (unsigned char *)SvPV(cust_hatch_sv, len);
}
else
cust_hatch = NULL;
Expand Down

0 comments on commit a309fbc

Please sign in to comment.