From: Nicholas Clark Date: Sat, 22 Dec 2007 17:00:24 +0000 (+0000) Subject: Exterminate PL_na! Exterminate! Exterminate! Exterminate! X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfd025d94e67a140ec0eeee79dfcef213d537327;p=p5sagit%2Fp5-mst-13.2.git Exterminate PL_na! Exterminate! Exterminate! Exterminate! p4raw-id: //depot/perl@32704 --- diff --git a/ext/DB_File/typemap b/ext/DB_File/typemap index 077a95c..c46b685 100644 --- a/ext/DB_File/typemap +++ b/ext/DB_File/typemap @@ -29,8 +29,9 @@ T_dbtkeydatum $var.size = (int)sizeof(recno_t); } else if (SvOK(my_sv)) { - $var.data = SvPVbyte(my_sv, PL_na); - $var.size = (int)PL_na; + STRLEN len; + $var.data = SvPVbyte(my_sv, len); + $var.size = (int)len; } } T_dbtdatum @@ -40,8 +41,9 @@ T_dbtdatum DBT_clear($var) ; SvGETMAGIC(my_sv) ; if (SvOK(my_sv)) { - $var.data = SvPVbyte(my_sv, PL_na); - $var.size = (int)PL_na; + STRLEN len; + $var.data = SvPVbyte(my_sv, len); + $var.size = (int)len; } } diff --git a/ext/GDBM_File/typemap b/ext/GDBM_File/typemap index 3e69721..71fc285 100644 --- a/ext/GDBM_File/typemap +++ b/ext/GDBM_File/typemap @@ -16,25 +16,30 @@ FATALFUNC T_OPAQUEPTR INPUT T_DATUM_K DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + { + STRLEN len; + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; + } T_DATUM_K_C { SV * tmpSV; + STRLEN len; if (db->filter_store_key) { tmpSV = sv_2mortal(newSVsv($arg)); DBM_ckFilter(tmpSV, filter_store_key, \"filter_store_key\"); } else tmpSV = $arg; - $var.dptr = SvPVbyte(tmpSV, PL_na); - $var.dsize = (int)PL_na; + $var.dptr = SvPVbyte(tmpSV, len); + $var.dsize = (int)len; } T_DATUM_V DBM_ckFilter($arg, filter_store_value, \"filter_store_value\"); if (SvOK($arg)) { - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + STRLEN len; + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; } else { $var.dptr = (char *)\"\"; diff --git a/ext/NDBM_File/typemap b/ext/NDBM_File/typemap index b07695d..ad62e0a 100644 --- a/ext/NDBM_File/typemap +++ b/ext/NDBM_File/typemap @@ -15,14 +15,18 @@ FATALFUNC T_OPAQUEPTR INPUT T_DATUM_K - DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + { + STRLEN len; + DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; + } T_DATUM_V DBM_ckFilter($arg, filter_store_value, \"filter_store_value\"); if (SvOK($arg)) { - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + STRLEN len; + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; } else { $var.dptr = (char *)\"\"; diff --git a/ext/ODBM_File/typemap b/ext/ODBM_File/typemap index cbc89b0..e4d8596 100644 --- a/ext/ODBM_File/typemap +++ b/ext/ODBM_File/typemap @@ -16,26 +16,31 @@ FATALFUNC T_OPAQUEPTR INPUT T_DATUM_K - DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + { + STRLEN len; +3B DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; + } T_DATUM_K_C { SV * tmpSV ; + STRLEN len; if (db->filter_store_key){ tmpSV = sv_2mortal(newSVsv($arg)); DBM_ckFilter(tmpSV, filter_store_key, \"filter_store_key\"); } else tmpSV = $arg; - $var.dptr = SvPVbyte(tmpSV, PL_na); - $var.dsize = (int)PL_na; + $var.dptr = SvPVbyte(tmpSV, len); + $var.dsize = (int)len; } T_DATUM_V DBM_ckFilter($arg, filter_store_value, \"filter_store_value\"); if (SvOK($arg)) { - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + STRLEN len; + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; } else { $var.dptr = \"\"; diff --git a/ext/SDBM_File/typemap b/ext/SDBM_File/typemap index c88725b..a06ce81 100644 --- a/ext/SDBM_File/typemap +++ b/ext/SDBM_File/typemap @@ -15,14 +15,18 @@ FATALFUNC T_OPAQUEPTR INPUT T_DATUM_K - DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + { + STRLEN len; + DBM_ckFilter($arg, filter_store_key, \"filter_store_key\"); + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; + } T_DATUM_V DBM_ckFilter($arg, filter_store_value, \"filter_store_value\"); if (SvOK($arg)) { - $var.dptr = SvPVbyte($arg, PL_na); - $var.dsize = (int)PL_na; + STRLEN len; + $var.dptr = SvPVbyte($arg, len); + $var.dsize = (int)len; } else { $var.dptr = \"\"; diff --git a/ext/Win32API/File/buffers.h b/ext/Win32API/File/buffers.h index 2ae74e6..934e57b 100644 --- a/ext/Win32API/File/buffers.h +++ b/ext/Win32API/File/buffers.h @@ -214,7 +214,7 @@ #define null_arg(sv) ( SvROK(sv) && SVt_PVAV == SvTYPE(SvRV(sv)) \ && -1 == av_len((AV*)SvRV(sv)) ) -#define PV_or_null(sv) ( null_arg(sv) ? NULL : SvPV(sv,PL_na) ) +#define PV_or_null(sv) ( null_arg(sv) ? NULL : SvPV_nolen(sv) ) /* Minimum buffer size to use when no buffer existed: */ #define MIN_GROW_SIZE 128 @@ -233,7 +233,7 @@ /* Whether the buffer size we got lets us change what buffer size we use: */ #define autosize(sv) (!( SvOK(sv) && ! SvROK(sv) \ - && SvPV(sv,PL_na) && '=' == *SvPV(sv,PL_na) )) + && SvPV_nolen(sv) && '=' == *SvPV_nolen(sv) )) /* Get the IV/UV for a parameter that might be C<[]> or C: */ #define optIV(sv) ( null_arg(sv) ? 0 : !SvOK(sv) ? 0 : SvIV(sv) ) @@ -259,7 +259,7 @@ /* Initialize a buffer size argument of type DWORD: */ #define init_buf_l( svSize ) \ ( null_arg(svSize) ? 0 : autosize(svSize) ? optUV(svSize) \ - : strtoul( 1+SvPV(svSize,PL_na), NULL, 10 ) ) + : strtoul( 1+SvPV_nolen(svSize), NULL, 10 ) ) /* In INPUT section put "= init_buf_l($arg);" after variable name. */ /* Lengths in WCHARs are initialized the same as lengths in bytes: */ diff --git a/ext/Win32API/File/typemap b/ext/Win32API/File/typemap index d595765..2134712 100644 --- a/ext/Win32API/File/typemap +++ b/ext/Win32API/File/typemap @@ -32,7 +32,7 @@ T_BUF if( null_arg($arg) ) $var= NULL; else - $var= ($type) SvPV( $arg, PL_na ) + $var= ($type) SvPV_nolen( $arg ) T_SBUF grow_buf( $var,$arg, $type ) T_IV diff --git a/os2/OS2/typemap b/os2/OS2/typemap index b6f0e07..12bd58d 100644 --- a/os2/OS2/typemap +++ b/os2/OS2/typemap @@ -17,9 +17,9 @@ PCSZ T_PVNULLC ############################################################################# INPUT T_PVNULL - $var = ( SvOK($arg) ? ($type)SvPV($arg,PL_na) : NULL ) + $var = ( SvOK($arg) ? ($type)SvPV_nolen($arg) : NULL ) T_PVNULLC - $var = ( SvOK($arg) ? ($type)SvPV($arg,PL_na) : NULL ) + $var = ( SvOK($arg) ? ($type)SvPV_nolen($arg) : NULL ) ############################################################################# OUTPUT T_PVNULL diff --git a/os2/os2.c b/os2/os2.c index ff1c7bb..53480e3 100644 --- a/os2/os2.c +++ b/os2/os2.c @@ -4092,7 +4092,7 @@ XS(XS_OS2_pipe) Perl_croak(aTHX_ "Usage: OS2::pipe(pszName, ulOpenMode, connect= 1, count= 1, ulInbufLength= 8192, ulOutbufLength= ulInbufLength, ulPipeMode= count | NP_NOWAIT | NP_TYPE_BYTE | NP_READMODE_BYTE, ulTimeout= 0)"); { ULONG RETVAL; - PCSZ pszName = ( SvOK(ST(0)) ? (PCSZ)SvPV(ST(0),PL_na) : NULL ); + PCSZ pszName = ( SvOK(ST(0)) ? (PCSZ)SvPV_nolen(ST(0)) : NULL ); HPIPE hpipe; SV *OpenMode = ST(1); ULONG ulOpenMode; @@ -4450,7 +4450,7 @@ XS(XS_OS2_open) ULONG rc; #line 113 "pipe.c" ULONG RETVAL; - PCSZ pszFileName = ( SvOK(ST(0)) ? (PCSZ)SvPV(ST(0),PL_na) : NULL ); + PCSZ pszFileName = ( SvOK(ST(0)) ? (PCSZ)SvPV_nolen(ST(0)) : NULL ); HFILE hFile; ULONG ulAction; ULONG ulOpenMode = (ULONG)SvUV(ST(1)); diff --git a/pod/perltodo.pod b/pod/perltodo.pod index d869b67..f270d6b 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -365,11 +365,6 @@ Make F be updated by F. These tasks would need a little C knowledge, but don't need any specific background or experience with XS, or how the Perl interpreter works -=head2 Exterminate PL_na! - -C festers still in the darkest corners of various typemap files. -It needs to be exterminated, replaced by a local variable of type C. - =head2 Modernize the order of directories in @INC The way @INC is laid out by default, one cannot upgrade core (dual-life) diff --git a/pod/perlxs.pod b/pod/perlxs.pod index facfcf9..c045564 100644 --- a/pod/perlxs.pod +++ b/pod/perlxs.pod @@ -562,7 +562,7 @@ and $type can be used as in typemaps. bool_t rpcb_gettime(host,timep) - char *host = (char *)SvPV($arg,PL_na); + char *host = (char *)SvPV_nolen($arg); time_t &timep = 0; OUTPUT: timep @@ -589,7 +589,7 @@ Here's a truly obscure example: bool_t rpcb_gettime(host,timep) time_t &timep; /* \$v{timep}=@{[$v{timep}=$arg]} */ - char *host + SvOK($v{timep}) ? SvPV($arg,PL_na) : NULL; + char *host + SvOK($v{timep}) ? SvPV_nolen($arg) : NULL; OUTPUT: timep diff --git a/vms/vms.c b/vms/vms.c index a579d37..81404bc 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -12673,8 +12673,7 @@ mod2fname(pTHX_ CV *cv) if (counter) { strcat(work_name, "__"); } - strcat(work_name, SvPV(*av_fetch(in_array, counter, FALSE), - PL_na)); + strcat(work_name, SvPV_nolen(*av_fetch(in_array, counter, FALSE))); } /* Check to see if we actually have to bother...*/