You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/05/21 22:16:44 UTC
svn commit: r171248 - in /httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request:
Cookie/Cookie.xs Param/Param.xs
Author: joes
Date: Sat May 21 13:16:43 2005
New Revision: 171248
URL: http://svn.apache.org/viewcvs?rev=171248&view=rev
Log:
Allow cookie_class and param_class to take an
undef argument, matching the documentation.
Modified:
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs?rev=171248&r1=171247&r2=171248&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Cookie/Cookie.xs Sat May 21 13:16:43 2005
@@ -268,9 +268,9 @@
MODULE = APR::Request::Cookie PACKAGE = APR::Request::Cookie::Table
SV *
-cookie_class(t, newclass=NULL)
+cookie_class(t, subclass=&PL_sv_undef)
APR::Request::Cookie::Table t
- char *newclass
+ SV *subclass
PREINIT:
SV *obj = apreq_xs_sv2object(aTHX_ ST(0), COOKIE_TABLE_CLASS, 't');
@@ -280,14 +280,22 @@
CODE:
RETVAL = (curclass == NULL) ? &PL_sv_undef : newSVpv(curclass, 0);
- if (newclass != NULL) {
- if (!sv_derived_from(ST(1), COOKIE_CLASS))
+ if (items == 2) {
+ if (!SvOK(subclass)) {
+ mg->mg_ptr = NULL;
+ mg->mg_len = 0;
+ }
+ else if (!sv_derived_from(subclass, COOKIE_CLASS)) {
Perl_croak(aTHX_ "Usage: "
COOKIE_TABLE_CLASS "::cookie_class($table, $class): "
- "class %s is not derived from " COOKIE_CLASS, newclass);
- mg->mg_ptr = savepv(newclass);
- mg->mg_len = strlen(newclass);
-
+ "class %s is not derived from " COOKIE_CLASS,
+ SvPV_nolen(subclass));
+ }
+ else {
+ STRLEN len;
+ mg->mg_ptr = savepv(SvPV(subclass, len));
+ mg->mg_len = len;
+ }
if (curclass != NULL)
Safefree(curclass);
}
Modified: httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs
URL: http://svn.apache.org/viewcvs/httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs?rev=171248&r1=171247&r2=171248&view=diff
==============================================================================
--- httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs (original)
+++ httpd/apreq/trunk/glue/perl/xsbuilder/APR/Request/Param/Param.xs Sat May 21 13:16:43 2005
@@ -130,9 +130,9 @@
MODULE = APR::Request::Param PACKAGE = APR::Request::Param::Table
SV *
-param_class(t, newclass=NULL)
+param_class(t, subclass=&PL_sv_undef)
APR::Request::Param::Table t
- char *newclass
+ SV *subclass
PREINIT:
SV *obj = apreq_xs_sv2object(aTHX_ ST(0), PARAM_TABLE_CLASS, 't');
@@ -142,14 +142,22 @@
CODE:
RETVAL = (curclass == NULL) ? &PL_sv_undef : newSVpv(curclass, 0);
- if (newclass != NULL) {
- if (!sv_derived_from(ST(1), PARAM_CLASS))
+ if (items == 2) {
+ if (!SvOK(subclass)) {
+ mg->mg_ptr = NULL;
+ mg->mg_len = 0;
+ }
+ else if (!sv_derived_from(subclass, PARAM_CLASS)) {
Perl_croak(aTHX_ "Usage: "
PARAM_TABLE_CLASS "::param_class($table, $class): "
- "class %s is not derived from " PARAM_CLASS, newclass);
- mg->mg_ptr = savepv(newclass);
- mg->mg_len = strlen(newclass);
-
+ "class %s is not derived from " PARAM_CLASS,
+ SvPV_nolen(subclass));
+ }
+ else {
+ STRLEN len;
+ mg->mg_ptr = savepv(SvPV(subclass, len));
+ mg->mg_len = len;
+ }
if (curclass != NULL)
Safefree(curclass);
}