Apache HTTPD
apr_general.h
Go to the documentation of this file.
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#ifndef APR_GENERAL_H
18#define APR_GENERAL_H
19
28#include "apr.h"
29#include "apr_pools.h"
30#include "apr_errno.h"
31
32#if APR_HAVE_SIGNAL_H
33#include <signal.h>
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
50#ifndef FALSE
51#define FALSE 0
52#endif
54#ifndef TRUE
55#define TRUE (!FALSE)
56#endif
57
59#define APR_ASCII_BLANK '\040'
61#define APR_ASCII_CR '\015'
63#define APR_ASCII_LF '\012'
65#define APR_ASCII_TAB '\011'
66
68typedef int apr_signum_t;
69
79#if defined(CRAY) || (defined(__arm) && !(defined(LINUX) || defined(__FreeBSD__)))
80#ifdef __STDC__
81#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
82#else
83#ifdef CRAY2
84#define APR_OFFSET(p_type,field) \
85 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
86
87#else /* !CRAY2 */
88
89#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
90
91#endif /* !CRAY2 */
92#endif /* __STDC__ */
93#else /* ! (CRAY || __arm) */
94
95#define APR_OFFSET(p_type,field) \
96 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
97
98#endif /* !CRAY */
99
106#if defined(__has_builtin)
107#if __has_builtin(__builtin_offsetof)
108#define APR_OFFSETOF(s_type,field) __builtin_offsetof(s_type,field)
109#endif
110#endif /* __has_builtin */
111#ifndef APR_OFFSETOF
112#if defined(offsetof) && !defined(__cplusplus)
113#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
114#else
115#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
116#endif
117#endif /* ndef APR_OFFSETOF */
118
119#ifndef DOXYGEN
120
121/* A couple of prototypes for functions in case some platform doesn't
122 * have it
123 */
124#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
125#define strcasecmp(s1, s2) stricmp(s1, s2)
126#elif (!APR_HAVE_STRCASECMP)
127int strcasecmp(const char *a, const char *b);
128#endif
129
130#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
131#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
132#elif (!APR_HAVE_STRNCASECMP)
133int strncasecmp(const char *a, const char *b, size_t n);
134#endif
135
136#endif
137
142/* APR_ALIGN() is only to be used to align on a power of 2 boundary */
143#define APR_ALIGN(size, boundary) \
144 (((size) + ((boundary) - 1)) & ~((boundary) - 1))
145
147#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
148
149
154/* APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it */
155#ifndef APR_STRINGIFY
157#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
159#define APR_STRINGIFY_HELPER(n) #n
160#endif
161
162#if (!APR_HAVE_MEMMOVE)
163#define memmove(a,b,c) bcopy(b,a,c)
164#endif
165
166#if (!APR_HAVE_MEMCHR)
167void *memchr(const void *s, int c, size_t n);
168#endif
169
185
199 char const * const * *argv,
200 char const * const * *env);
201
214
224APR_DECLARE(void) apr_terminate2(void);
225
233#if APR_HAS_RANDOM || defined(DOXYGEN)
234
235/* TODO: I'm not sure this is the best place to put this prototype...*/
243
244#endif
247#ifdef __cplusplus
248}
249#endif
250
251#endif /* ! APR_GENERAL_H */
int n
Definition ap_regex.h:278
APR Error Codes.
APR memory allocation.
const unsigned char * buf
Definition util_md5.h:50
apr_bucket apr_bucket_brigade * a
int apr_off_t * length
apr_size_t size
int apr_status_t
Definition apr_errno.h:44
void * memchr(const void *s, int c, size_t n)
int strcasecmp(const char *a, const char *b)
int strncasecmp(const char *a, const char *b, size_t n)
int apr_signum_t
Definition apr_general.h:68
apr_pool_t int argc
Definition apr_getopt.h:104
apr_vformatter_buff_t * c
Definition apr_lib.h:175
char const *const char const *const ** env
char const *const ** argv
APR_DECLARE(void) apr_terminate2(void)
Definition apr_pools.h:646
APR_DECLARE_NONSTD(void) apr_terminate(void)
Definition start.c:173
apr_pool_t * b
Definition apr_pools.h:529
const char * s
Definition apr_strings.h:95