"Fossies" - the Fresh Open Source Software Archive

Member "mod_perl-2.0.11/src/modules/perl/modperl_common_util.h" (5 Oct 2019, 3591 Bytes) of package /linux/www/apache_httpd_modules/mod_perl-2.0.11.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "modperl_common_util.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.0.8_vs_2.0.9.

    1 /* Licensed to the Apache Software Foundation (ASF) under one or more
    2  * contributor license agreements.  See the NOTICE file distributed with
    3  * this work for additional information regarding copyright ownership.
    4  * The ASF licenses this file to You under the Apache License, Version 2.0
    5  * (the "License"); you may not use this file except in compliance with
    6  * the License.  You may obtain a copy of the License at
    7  *
    8  *     http://www.apache.org/licenses/LICENSE-2.0
    9  *
   10  * Unless required by applicable law or agreed to in writing, software
   11  * distributed under the License is distributed on an "AS IS" BASIS,
   12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13  * See the License for the specific language governing permissions and
   14  * limitations under the License.
   15  */
   16 
   17 #include "modperl_common_includes.h"
   18 
   19 #ifndef MODPERL_COMMON_UTIL_H
   20 #define MODPERL_COMMON_UTIL_H
   21 
   22 #ifdef MP_DEBUG
   23 #define MP_INLINE
   24 #else
   25 #define MP_INLINE APR_INLINE
   26 #endif
   27 
   28 #ifdef CYGWIN
   29 #define MP_STATIC
   30 #else
   31 #define MP_STATIC static
   32 #endif
   33 
   34 #ifdef WIN32
   35 #   define MP_FUNC_T(name)          (_stdcall *name)
   36 #   define MP_FUNC_NONSTD_T(name)   (*name)
   37 /* XXX: not all functions get inlined
   38  * so its unclear what to and not to include in the .def files
   39  */
   40 #   undef MP_INLINE
   41 #   define MP_INLINE
   42 #else
   43 #   define MP_FUNC_T(name)          (*name)
   44 #   define MP_FUNC_NONSTD_T(name)   (*name)
   45 #endif
   46 
   47 
   48 #define MP_SSTRLEN(string) (sizeof(string)-1)
   49 
   50 #ifndef strcaseEQ
   51 #   define strcaseEQ(s1,s2) (!strcasecmp(s1,s2))
   52 #endif
   53 #ifndef strncaseEQ
   54 #   define strncaseEQ(s1,s2,l) (!strncasecmp(s1,s2,l))
   55 #endif
   56 
   57 #ifndef SvCLASS
   58 #define SvCLASS(o) HvNAME(SvSTASH(SvRV(o)))
   59 #endif
   60 
   61 #define SvObjIV(o) SvIV((SV*)SvRV(o))
   62 #define MgObjIV(m) SvIV((SV*)SvRV(m->mg_obj))
   63 
   64 #define MP_SvGROW(sv, len) \
   65     (void)SvUPGRADE(sv, SVt_PV); \
   66     SvGROW(sv, len+1)
   67 
   68 #define MP_SvCUR_set(sv, len) \
   69     SvCUR_set(sv, len); \
   70     *SvEND(sv) = '\0'; \
   71     SvPOK_only(sv)
   72 
   73 #define MP_magical_untie(sv, mg_flags) \
   74     mg_flags = SvMAGICAL((SV*)sv); \
   75     SvMAGICAL_off((SV*)sv)
   76 
   77 #define MP_magical_tie(sv, mg_flags) \
   78     SvFLAGS((SV*)sv) |= mg_flags
   79 
   80 /* some wrapper macros to detect perl versions
   81  * and prevent code clutter */
   82 #define MP_PERL_VERSION_AT_LEAST(r, v, s)                                \
   83     (PERL_REVISION == r &&                                               \
   84     ((PERL_VERSION == v && PERL_SUBVERSION > s-1) || PERL_VERSION > v))
   85 
   86 #define MP_PERL_VERSION_AT_MOST(r, v, s)                                 \
   87    (PERL_REVISION == r &&                                                \
   88    (PERL_VERSION < v || (PERL_VERSION == v && PERL_SUBVERSION < s+1)))
   89 
   90 #define MP_PERL_VERSION(r, v, s)                                         \
   91   (PERL_REVISION == r && PERL_VERSION == v && PERL_SUBVERSION == s)
   92 
   93 /* tie %hash */
   94 MP_INLINE SV *modperl_hash_tie(pTHX_ const char *classname,
   95                                SV *tsv, void *p);
   96 
   97 /* tied %hash */
   98 MP_INLINE SV *modperl_hash_tied_object_rv(pTHX_
   99                                           const char *classname,
  100                                           SV *tsv);
  101 /* tied %hash */
  102 MP_INLINE void *modperl_hash_tied_object(pTHX_ const char *classname,
  103                                          SV *tsv);
  104 
  105 MP_INLINE SV *modperl_perl_sv_setref_uv(pTHX_ SV *rv,
  106                                         const char *classname, UV uv);
  107 
  108 MP_INLINE modperl_uri_t *modperl_uri_new(apr_pool_t *p);
  109 
  110 SV *modperl_perl_gensym(pTHX_ char *pack);
  111 
  112 #endif /* MODPERL_COMMON_UTIL_H */
  113 
  114 /*
  115  * Local Variables:
  116  * c-basic-offset: 4
  117  * indent-tabs-mode: nil
  118  * End:
  119  */