dougm       01/03/04 19:53:29

  Added:       xs/APR/Base64 APR__Base64.h
               xs/APR/Brigade APR__Brigade.h
               xs/APR/Lib APR__Lib.h
               xs/APR/Lock APR__Lock.h
               xs/APR/Pool APR__Pool.h
               xs/APR/UUID APR__UUID.h
  Log:
  start of the wrapper functions for APR
  
  Revision  Changes    Path
  1.1                  modperl-2.0/xs/APR/Base64/APR__Base64.h
  
  Index: APR__Base64.h
  ===================================================================
  static MP_INLINE void mpxs_apr_base64_encode(pTHX_ SV *sv, SV *arg)
  {
      STRLEN len;
      int encoded_len;
      char *data = SvPV(arg, len);
      mpxs_sv_grow(sv, apr_base64_encode_len(len));
      encoded_len = apr_base64_encode_binary(SvPVX(sv), data, len);
      mpxs_sv_cur_set(sv, encoded_len);
  }
  
  static MP_INLINE void mpxs_apr_base64_decode(pTHX_ SV *sv, SV *arg)
  {
      STRLEN len;
      int decoded_len;
      char *data = SvPV(arg, len);
      mpxs_sv_grow(sv, apr_base64_decode_len(data));
      decoded_len = apr_base64_decode_binary(SvPVX(sv), data);
      mpxs_sv_cur_set(sv, decoded_len);
  }
  
  static XS(MPXS_apr_base64_encode)
  {
      dXSARGS;
  
      mpxs_usage_items_1("data");
  
      mpxs_set_targ(mpxs_apr_base64_encode, ST(0));
  }
  
  static XS(MPXS_apr_base64_decode)
  {
      dXSARGS;
  
      mpxs_usage_items_1("data");
  
      mpxs_set_targ(mpxs_apr_base64_decode, ST(0));
  }
  
  
  
  1.1                  modperl-2.0/xs/APR/Brigade/APR__Brigade.h
  
  Index: APR__Brigade.h
  ===================================================================
  static MP_INLINE apr_bucket_brigade *mpxs_apr_brigade_create(pTHX_ SV *CLASS,
                                                               apr_pool_t *p)
  {
      return apr_brigade_create(p);
  }
  
  
  
  1.1                  modperl-2.0/xs/APR/Lib/APR__Lib.h
  
  Index: APR__Lib.h
  ===================================================================
  static MP_INLINE void mpxs_apr_strerror(pTHX_ SV *sv, SV *arg)
  {
      apr_status_t statcode = mp_xs_sv2_status(arg);
      char *ptr;
      mpxs_sv_grow(sv, 128-1);
      ptr = apr_strerror(statcode, SvPVX(sv), SvLEN(sv));
      mpxs_sv_cur_set(sv, strlen(ptr)); /*XXX*/
  }
  
  static MP_INLINE void mpxs_apr_generate_random_bytes(pTHX_ SV *sv, SV *arg)
  {
      int len = (int)SvIV(arg);
      mpxs_sv_grow(sv, len);
      (void)apr_generate_random_bytes(SvPVX(sv), len);
      mpxs_sv_cur_set(sv, len);
  }
  
  static XS(MPXS_apr_strerror)
  {
      dXSARGS;
  
      mpxs_usage_items_1("status_code");
  
      mpxs_set_targ(mpxs_apr_strerror, ST(0));
  }
  
  static XS(MPXS_apr_generate_random_bytes)
  {
      dXSARGS;
  
      mpxs_usage_items_1("length");
  
      mpxs_set_targ(mpxs_apr_generate_random_bytes, ST(0));
  }
  
  
  
  1.1                  modperl-2.0/xs/APR/Lock/APR__Lock.h
  
  Index: APR__Lock.h
  ===================================================================
  #define apr_lock_DESTROY(lock) (void)apr_lock_destroy(lock)
  
  static MP_INLINE apr_lock_t *mpxs_apr_lock_create(pTHX_ SV *CLASS,
                                                    apr_pool_t *p,
                                                    apr_locktype_e type,
                                                    apr_lockscope_e scope,
                                                    const char *fname)
  {
      apr_lock_t *retval=NULL;
      (void)apr_lock_create(&retval, type, scope, fname, p);
      return retval;
  }
  
  
  
  1.1                  modperl-2.0/xs/APR/Pool/APR__Pool.h
  
  Index: APR__Pool.h
  ===================================================================
  #define apr_pool_DESTROY(p) apr_pool_destroy(p)
  
  static MP_INLINE apr_pool_t *mpxs_apr_pool_create(pTHX_ SV *obj)
  {
      apr_pool_t *parent = (apr_pool_t *)mpxs_sv_object_deref(obj);
      apr_pool_t *retval = NULL;
      (void)apr_pool_create(&retval, parent);
      return retval;
  }
  
  
  
  1.1                  modperl-2.0/xs/APR/UUID/APR__UUID.h
  
  Index: APR__UUID.h
  ===================================================================
  #define mpxs_apr_uuid_alloc() \
  (apr_uuid_t *)safemalloc(sizeof(apr_uuid_t))
  
  static MP_INLINE apr_uuid_t *mpxs_apr_uuid_get(pTHX_ SV *CLASS)
  {
      apr_uuid_t *uuid = mpxs_apr_uuid_alloc();
      apr_uuid_get(uuid);
      return uuid;
  }
  
  static MP_INLINE void mp_apr_uuid_format(pTHX_ SV *sv, SV *obj)
  {
      apr_uuid_t *uuid = mp_xs_sv2_uuid(obj);
      mpxs_sv_grow(sv, APR_UUID_FORMATTED_LENGTH);
      apr_uuid_format(SvPVX(sv), uuid);
      mpxs_sv_cur_set(sv, APR_UUID_FORMATTED_LENGTH);
  }
  
  static MP_INLINE apr_uuid_t *mpxs_apr_uuid_parse(pTHX_ SV *CLASS, char *buf)
  {
      apr_uuid_t *uuid = mpxs_apr_uuid_alloc();
      apr_uuid_parse(uuid, buf);
      return uuid;
  }
  
  static XS(MPXS_apr_uuid_format)
  {
      dXSARGS;
  
      mpxs_usage_items_1("uuid");
  
      mpxs_set_targ(mp_apr_uuid_format, ST(0));
  }
  
  #define apr_uuid_DESTROY(uuid) safefree(uuid)
  
  
  

Reply via email to