[DBD::Pg 1/3] Use sv_copypv, as suggested in comment

dbdpg-commits-gENoVmVU/[email protected] Wed, 8 Apr 2015 23:21:45 +0000
Newsgroups gmane.comp.db.postgresql.dbdpg.cvs
Message-ID <[email protected]>
Committed by =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <[email protected]>

Subject: [DBD::Pg 1/3] Use sv_copypv, as suggested in comment

We now require 5.8.1, so we can use this function.
---
 dbdimp.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/dbdimp.c b/dbdimp.c
index c6e8d56..2d23fbb 100644
--- a/dbdimp.c
+++ b/dbdimp.c
@@ -3765,17 +3765,8 @@ AV * dbd_st_fetch (SV * sth, imp_sth_t * imp_sth)
 	if (imp_sth->use_inout) {
 		ph_t *currph;
 		for (i=0,currph=imp_sth->ph; NULL != currph && i < num_fields; currph=currph->nextph,i++) {
-			if (currph->isinout) {
-				/* When we have Perl 5.7.3 or better as a pre-req:
-				   sv_copypv(currph->inout, AvARRAY(av)[i]);
-				*/
-				const char * const s = SvPV(AvARRAY(av)[i],len);
-				sv_setpvn(currph->inout, s, len);
-				if (SvUTF8(AvARRAY(av)[i]))
-					SvUTF8_on(currph->inout);
-				else
-					SvUTF8_off(currph->inout);
-			}
+			if (currph->isinout)
+				sv_copypv(currph->inout, AvARRAY(av)[i]);
 		}
 	}
 
-- 
1.8.4