Permalink
Browse files

[rt #69243] simplify XS for i_tags_find() and i_tags_findn()

Use SysRet for return values, and use XSRETURN_UNDEF for the undef case
  • Loading branch information...
1 parent a4da28d commit f4aca8311f3193170163be4f7a27f10a8932ebb6 @tonycoz committed May 24, 2013
Showing with 6 additions and 12 deletions.
  1. +6 −12 Imager.xs
View
@@ -3676,7 +3676,7 @@ i_tags_add(im, name_sv, code, data_sv, idata)
OUTPUT:
RETVAL
-SV *
+SysRet
i_tags_find(im, name, start)
Imager::ImgRaw im
char *name
@@ -3685,17 +3685,14 @@ i_tags_find(im, name, start)
int entry;
CODE:
if (i_tags_find(&im->tags, name, start, &entry)) {
- if (entry == 0)
- RETVAL = newSVpv("0 but true", 0);
- else
- RETVAL = newSViv(entry);
+ RETVAL = entry;
} else {
- RETVAL = &PL_sv_undef;
+ XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
-SV *
+SysRet
i_tags_findn(im, code, start)
Imager::ImgRaw im
int code
@@ -3704,13 +3701,10 @@ i_tags_findn(im, code, start)
int entry;
CODE:
if (i_tags_findn(&im->tags, code, start, &entry)) {
- if (entry == 0)
- RETVAL = newSVpv("0 but true", 0);
- else
- RETVAL = newSViv(entry);
+ RETVAL = entry;
}
else {
- RETVAL = &PL_sv_undef;
+ XSRETURN_UNDEF;
}
OUTPUT:
RETVAL

0 comments on commit f4aca83

Please sign in to comment.