diff options
Diffstat (limited to 'ext/Time/Piece/Piece.xs')
-rw-r--r-- | ext/Time/Piece/Piece.xs | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/ext/Time/Piece/Piece.xs b/ext/Time/Piece/Piece.xs index a639af5d60..bae2d4c7bf 100644 --- a/ext/Time/Piece/Piece.xs +++ b/ext/Time/Piece/Piece.xs @@ -25,11 +25,21 @@ __strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = - int wday int yday int isdst + + PREINIT: + char *buf = NULL; + CODE: - { - char *buf = my_strftime(fmt, sec, min, hour, mday, mon, year, wday, yday, isdst); - if (buf) { - ST(0) = sv_2mortal(newSVpv(buf, 0)); - Safefree(buf); - } - } + #XXX: an sv_strftime() that can make use of the TARG would faster + buf = my_strftime(fmt, sec, min, hour, mday, mon, year, wday, yday, isdst); + if (buf) { + RETVAL = buf; + } + + OUTPUT: + RETVAL + + CLEANUP: + if (buf) { + Safefree(buf); + } |