Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_strings.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 /* Portions of this file are covered by */
18 /* -*- mode: c; c-file-style: "k&r" -*-
19 
20  strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
21  Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
22 
23  This software is provided 'as-is', without any express or implied
24  warranty. In no event will the authors be held liable for any damages
25  arising from the use of this software.
26 
27  Permission is granted to anyone to use this software for any purpose,
28  including commercial applications, and to alter it and redistribute it
29  freely, subject to the following restrictions:
30 
31  1. The origin of this software must not be misrepresented; you must not
32  claim that you wrote the original software. If you use this software
33  in a product, an acknowledgment in the product documentation would be
34  appreciated but is not required.
35  2. Altered source versions must be plainly marked as such, and must not be
36  misrepresented as being the original software.
37  3. This notice may not be removed or altered from any source distribution.
38 */
39 
40 #ifndef APR_STRINGS_H
41 #define APR_STRINGS_H
42 
48 #include "apr.h"
49 #include "apr_errno.h"
50 #include "apr_pools.h"
51 #define APR_WANT_IOVEC
52 #include "apr_want.h"
53 
54 #if APR_HAVE_STDARG_H
55 #include <stdarg.h>
56 #endif
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif /* __cplusplus */
61 
76 APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
77 
87 APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b);
88 
95 APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
96 
109 APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n)
110 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
111  __attribute__((alloc_size(3)))
112 #endif
113  ;
114 
125 APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
126 
135 APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n)
136 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
137  __attribute__((alloc_size(3)))
138 #endif
139  ;
140 
148 #if defined(__GNUC__) && __GNUC__ >= 4
149  __attribute__((sentinel))
150 #endif
151  ;
152 
161 APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
162  apr_size_t nvec, apr_size_t *nbytes);
163 
172 APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
173 
182 APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
183  __attribute__((format(printf,2,3)));
184 
207 APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src,
208  apr_size_t dst_size);
209 
217 APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
218 
226 APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
227  char ***argv_out,
228  apr_pool_t *token_context);
229 
247 APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last);
248 
279 APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
280  const char *format, ...)
281  __attribute__((format(printf,3,4)));
282 
291 APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
292  va_list ap);
301 APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n);
302 
309 APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n);
310 
318 
335 APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf,
336  char **end, int base);
337 
353 APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base);
354 
362 APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf);
363 
372 APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf);
373 
376 #ifdef __cplusplus
377 }
378 #endif
379 
380 #endif /* !APR_STRINGS_H */
size_t apr_size_t
Definition: apr.h:375
int apr_strnatcmp(char const *a, char const *b)
apr_status_t __attribute__((nonnull(1)))
apr_int64_t apr_atoi64(const char *buf)
int apr_snprintf(char *buf, apr_size_t len, const char *format,...) __attribute__((format(printf
char * apr_ltoa(apr_pool_t *p, long n)
#define APR_DECLARE_NONSTD(x)
Definition: macros.h:7
int apr_strnatcasecmp(char const *a, char const *b)
APR Standard Headers Support.
void * apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n)
char * apr_strtok(char *str, const char *sep, char **last)
char * apr_collapse_spaces(char *dest, const char *src)
dav_buffer apr_size_t size
Definition: mod_dav.h:461
apr_int64_t apr_strtoi64(const char *buf, char **end, int base)
char * apr_off_t_toa(apr_pool_t *p, apr_off_t n)
APR memory allocation.
apr_status_t apr_tokenize_to_argv(const char *arg_str, char ***argv_out, apr_pool_t *token_context)
char * apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap)
dav_error * src
Definition: mod_dav.h:186
char * apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n)
APR Error Codes.
char char * apr_cpystrn(char *dst, const char *src, apr_size_t dst_size)
char * apr_psprintf(apr_pool_t *p, const char *fmt,...) __attribute__((format(printf
APR Platform Definitions.
char * apr_strfsize(apr_off_t size, char *buf)
char * apr_pstrcatv(apr_pool_t *p, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes)
apr_pool_t * p
#define APR_DECLARE(x)
Definition: macros.h:6
char * apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n)
char * apr_itoa(apr_pool_t *p, int n)
dav_buffer const char * str
Definition: mod_dav.h:465
char * apr_pstrcat(apr_pool_t *p,...)
long apr_int64_t
Definition: apr.h:371
char * apr_pstrdup(apr_pool_t *p, const char *s)
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
int apr_status_t
Definition: apr_errno.h:44
off_t apr_off_t
Definition: apr.h:377
apr_status_t apr_strtoff(apr_off_t *offset, const char *buf, char **end, int base)
int int apr_vsnprintf(char *buf, apr_size_t len, const char *format, va_list ap)