]> git.imager.perl.org - imager.git/blobdiff - Imager.xs
- the internal i_tags_get_string() function now acts correctly for
[imager.git] / Imager.xs
index 63b981ed2c0f34e0c2b4126565e0a6a43b98ac35..711dcc75ce28a9c56f246285610647e8941cb97f 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -3960,6 +3960,29 @@ i_tags_get(im, index)
           }
         }
 
+void
+i_tags_get_string(im, what_sv)
+        Imager::ImgRaw  im
+        SV *what_sv
+      PREINIT:
+        char const *name = NULL;
+        int code;
+        char buffer[200];
+        int result;
+      PPCODE:
+        if (SvIOK(what_sv)) {
+          code = SvIV(what_sv);
+          name = NULL;
+        }
+        else {
+          name = SvPV_nolen(what_sv);
+          code = 0;
+        }
+        if (i_tags_get_string(&im->tags, name, code, buffer, sizeof(buffer))) {
+          EXTEND(SP, 1);
+          PUSHs(sv_2mortal(newSVpv(buffer, 0)));
+        }
+
 int
 i_tags_count(im)
         Imager::ImgRaw  im