httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/glue/perl/xsbuilder/Apache/Request Apache__Request.h
Date Fri, 11 Jul 2003 23:16:58 GMT
joes        2003/07/11 16:16:58

  Modified:    glue/perl/xsbuilder apreq_xs_postperl.h
               glue/perl/xsbuilder/Apache/Request Apache__Request.h
  Log:
  Minor GET macro cleanups.
  
  Revision  Changes    Path
  1.13      +32 -31    httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h
  
  Index: apreq_xs_postperl.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/apreq_xs_postperl.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- apreq_xs_postperl.h	27 Jun 2003 18:23:18 -0000	1.12
  +++ apreq_xs_postperl.h	11 Jul 2003 23:16:58 -0000	1.13
  @@ -296,7 +296,7 @@
   #define apreq_xs_push(attr,sv,d,key) do {                               \
        apr_table_t *t = apreq_xs_##attr##_sv2table(sv);                   \
        if (t)                                                             \
  -         apr_table_do(apreq_xs_do(attr), &d, t, key, NULL);             \
  +         apr_table_do(apreq_xs_do(attr), d, t, key, NULL);              \
   } while (0)
   
   /** 
  @@ -340,45 +340,46 @@
   {                                                                       \
       dXSARGS;                                                            \
       const char *key = NULL;                                             \
  +    struct apreq_xs_do_arg d = { NULL, aTHX };                          \
  +    void *env;                                                          \
                                                                           \
  -    if (items == 1 || items == 2 && SvROK(ST(0))) {                     \
  -        void *env = apreq_xs_##attr##_sv2env(ST(0));                    \
  -        struct apreq_xs_do_arg d = { env, aTHX };                       \
  -        apreq_##type##_t *RETVAL;                                       \
  -        if (items == 2)                                                 \
  -            key = SvPV_nolen(ST(1));                                    \
  +    if (items == 0 || items > 2 || !SvROK(ST(0)))                       \
  +        Perl_croak(aTHX_ "Usage: $table->get($key)");                   \
                                                                           \
  -        switch (GIMME_V) {                                              \
  -            apreq_##type##_t *RETVAL;                                   \
  +    env = apreq_xs_##attr##_sv2env(ST(0));                              \
  +    d.env = env;                                                        \
  +    if (items == 2)                                                     \
  +        key = SvPV_nolen(ST(1));                                        \
                                                                           \
  -        case G_ARRAY:                                                   \
  -            XSprePUSH;                                                  \
  -            PUTBACK;                                                    \
  -            apreq_xs_##attr##_push(ST(0), d, key);                      \
  -            break;                                                      \
  -                                                                        \
  -        case G_SCALAR:                                                  \
  -            if (items == 1) {                                           \
  -                apr_table_t *t = apreq_xs_##attr##_sv2table(ST(0));     \
  -                if (t == NULL)                                          \
  -                    XSRETURN_UNDEF;                                     \
  -                ST(0) = sv_2mortal(apreq_xs_table2sv(t,class));         \
  -                XSRETURN(1);                                            \
  -            }                                                           \
  +    switch (GIMME_V) {                                                  \
  +        apreq_##type##_t *RETVAL;                                       \
                                                                           \
  -            RETVAL = apreq_xs_##attr##_##type(ST(0), key);              \
  -            if (!RETVAL  || !(COND))                                    \
  +    case G_ARRAY:                                                       \
  +        XSprePUSH;                                                      \
  +        PUTBACK;                                                        \
  +        apreq_xs_##attr##_push(ST(0), &d, key);                         \
  +        break;                                                          \
  +                                                                        \
  +    case G_SCALAR:                                                      \
  +        if (items == 1) {                                               \
  +            apr_table_t *t = apreq_xs_##attr##_sv2table(ST(0));         \
  +            if (t == NULL)                                              \
                   XSRETURN_UNDEF;                                         \
  -            ST(0) = sv_2mortal(apreq_xs_##type##2sv(RETVAL,subclass));  \
  +            ST(0) = sv_2mortal(apreq_xs_table2sv(t,class));             \
               XSRETURN(1);                                                \
  -                                                                        \
  -        default:                                                        \
  -            XSRETURN(0);                                                \
           }                                                               \
  +                                                                        \
  +        RETVAL = apreq_xs_##attr##_##type(ST(0), key);                  \
  +        if (!(COND) || !RETVAL)                                         \
  +            XSRETURN_UNDEF;                                             \
  +        ST(0) = sv_2mortal(apreq_xs_##type##2sv(RETVAL,subclass));      \
  +        XSRETURN(1);                                                    \
  +                                                                        \
  +    default:                                                            \
  +        XSRETURN(0);                                                    \
       }                                                                   \
  -    else                                                                \
  -	Perl_croak(aTHX_ "Usage: $table->get($key)");                   \
   }
  +
   
   /** @} */
   
  
  
  
  1.14      +3 -3      httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h
  
  Index: Apache__Request.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Apache__Request.h	29 Jun 2003 03:41:17 -0000	1.13
  +++ Apache__Request.h	11 Jul 2003 23:16:58 -0000	1.14
  @@ -76,9 +76,9 @@
   #define S2P(s) (s ? apreq_value_to_param(apreq_strtoval(s)) : NULL)
   #define apreq_xs_request_push(sv,d,key) do {                            \
       apreq_request_t *req = apreq_xs_sv2(request,sv);                    \
  -    apr_table_do(apreq_xs_do(request), &d, req->args, key, NULL);       \
  +    apr_table_do(apreq_xs_do(request), d, req->args, key, NULL);        \
       if (req->body)                                                      \
  -        apr_table_do(apreq_xs_do(request), &d, req->body, key, NULL);   \
  +        apr_table_do(apreq_xs_do(request), d, req->body, key, NULL);    \
   } while (0)
   #define apreq_xs_args_push(sv,d,k) apreq_xs_push(args,sv,d,k)
   #define apreq_xs_body_push(sv,d,k) apreq_xs_push(body,sv,d,k)
  @@ -86,7 +86,7 @@
   #define apreq_xs_upload_push(sv,d,key) do {                             \
       apr_table_t *t = apreq_xs_body_sv2table(sv);                        \
       if (t)                                                              \
  -        apr_table_do(apreq_xs_do(upload), &d, t, key, NULL);            \
  +        apr_table_do(apreq_xs_do(upload), d, t, key, NULL);             \
   } while (0)
   
   #define apreq_xs_upload_table_push(sv,d,k) apreq_xs_push(upload_table,sv,d,k)
  
  
  

Mime
View raw message