You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@locus.apache.org on 2000/08/21 05:01:59 UTC

cvs commit: modperl-2.0/src/modules/perl modperl_util.c modperl_util.h

dougm       00/08/20 20:01:59

  Added:       src/modules/perl modperl_util.c modperl_util.h
  Log:
  utility functions
  
  Revision  Changes    Path
  1.1                  modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  #include "mod_perl.h"
  
  MP_INLINE request_rec *modperl_sv2request_rec(pTHX_ SV *sv)
  {
      request_rec *r = NULL;
  
      if (SvROK(sv) && (SvTYPE(SvRV(sv)) == SVt_PVMG)) {
          r = (request_rec *)SvIV((SV*)SvRV(sv));
      }
  
      return r;
  }
  
  MP_INLINE SV *modperl_ptr2obj(pTHX_ char *classname, void *ptr)
  {
      SV *sv = newSV(0);
  
      MP_TRACE_h(MP_FUNC, "sv_setref_pv(%s, 0x%lx)\n",
                 classname, (unsigned long)ptr);
      sv_setref_pv(sv, classname, ptr);
  
      return sv;
  }
  
  
  
  1.1                  modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===================================================================
  #ifndef MODPERL_UTIL_H
  #define MODPERL_UTIL_H
  
  #ifdef MP_DEBUG
  #define MP_INLINE
  #else
  #define MP_INLINE apr_inline
  #endif
  
  MP_INLINE request_rec *modperl_sv2request_rec(pTHX_ SV *sv);
  
  MP_INLINE SV *modperl_ptr2obj(pTHX_ char *classname, void *ptr);
  
  #define modperl_bless_request_rec(r) \
  modperl_ptr2obj("Apache", r)
  
  #endif /* MODPERL_UTIL_H */