From 7e203150a97248ce2566af0bc2b6bc61a6bf4ebe Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Tue, 26 Oct 2010 05:50:14 +0100 Subject: [PATCH] In I18N::Langinfo::langinfo(), use newSVpv(), as it will call strlen() newSVpv() will return an undef if the passed pointer is NULL, which allows langinfo() to be simplified further. --- ext/I18N-Langinfo/Langinfo.xs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ext/I18N-Langinfo/Langinfo.xs b/ext/I18N-Langinfo/Langinfo.xs index 62f3580..d087075 100644 --- a/ext/I18N-Langinfo/Langinfo.xs +++ b/ext/I18N-Langinfo/Langinfo.xs @@ -21,14 +21,7 @@ langinfo(code) PROTOTYPE: _ CODE: #ifdef HAS_NL_LANGINFO - { - char *s; - - if ((s = nl_langinfo(code))) - RETVAL = newSVpvn(s, strlen(s)); - else - RETVAL = &PL_sv_undef; - } + RETVAL = newSVpv(nl_langinfo(code), 0); #else croak("nl_langinfo() not implemented on this architecture"); #endif -- 1.8.3.1