From 05f2584a8988605388e70a7c2adf6611ad73e006 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 4 Jan 2019 09:38:50 +1100 Subject: [PATCH] simplify XS for i_img_to_pal() --- Imager.xs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Imager.xs b/Imager.xs index 7017e9a7..0ba1282c 100644 --- a/Imager.xs +++ b/Imager.xs @@ -3138,22 +3138,20 @@ i_img_pal_new(x, y, channels, maxpal) int maxpal Imager::ImgRaw -i_img_to_pal(src, quant) +i_img_to_pal(src, quant_hv) Imager::ImgRaw src + HV *quant_hv PREINIT: HV *hv; i_quantize quant; CODE: - if (!SvROK(ST(1)) || ! SvTYPE(SvRV(ST(1)))) - croak("i_img_to_pal: second argument must be a hash ref"); - hv = (HV *)SvRV(ST(1)); memset(&quant, 0, sizeof(quant)); quant.version = 1; quant.mc_size = 256; - ip_handle_quant_opts(aTHX_ &quant, hv); + ip_handle_quant_opts(aTHX_ &quant, quant_hv); RETVAL = i_img_to_pal(src, &quant); if (RETVAL) { - ip_copy_colors_back(aTHX_ hv, &quant); + ip_copy_colors_back(aTHX_ quant_hv, &quant); } ip_cleanup_quant_opts(aTHX_ &quant); OUTPUT: -- 2.39.5