You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/05/10 19:46:25 UTC
cvs commit: apache-apr/apr/lib apr_pools.c apr_snprintf.c
rbb 99/05/10 10:46:24
Modified: apr/include apr_lib.h apr_pools.h
apr/lib apr_pools.c apr_snprintf.c
Log:
Last time. This commit fixes the annyoing problems left over in the apr/lib
files.
Revision Changes Path
1.4 +128 -128 apache-apr/apr/include/apr_lib.h
Index: apr_lib.h
===================================================================
RCS file: /home/cvs/apache-apr/apr/include/apr_lib.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_lib.h 1999/04/30 15:19:55 1.3
+++ apr_lib.h 1999/05/10 17:46:19 1.4
@@ -53,7 +53,7 @@
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
- * The apr_vsnprintf/apr_snprintf functions are based on, and used with the
+ * The ap_vsnprintf/ap_snprintf functions are based on, and used with the
* permission of, the SIO stdio-replacement strx_* functions by Panos
* Tsirigotis <pa...@alumni.cs.colorado.edu> for xinetd.
*
@@ -81,25 +81,25 @@
* and tables are opaque structures to applications, but arrays are
* published.
*/
-typedef struct apr_pool_t apr_pool_t;
-typedef struct apr_table_t apr_table_t;
-typedef struct apr_child_info_t apr_child_info_t;
-typedef void apr_mutex_t;
-typedef struct apr_array_header_t {
- apr_pool_t *pool;
+typedef struct ap_pool_t ap_pool_t;
+typedef struct ap_table_t ap_table_t;
+typedef struct ap_child_info_t ap_child_info_t;
+typedef void ap_mutex_t;
+typedef struct ap_array_header_t {
+ ap_pool_t *pool;
int elt_size;
int nelts;
int nalloc;
char *elts;
-} apr_array_header_t;
+} ap_array_header_t;
/*
* Structure used by the variable-formatter routines.
*/
-typedef struct apr_vformatter_buff_t {
+typedef struct ap_vformatter_buff_t {
char *curpos;
char *endpos;
-} apr_vformatter_buff_t;
+} ap_vformatter_buff_t;
enum kill_conditions {
kill_never, /* process is never sent any signals */
@@ -112,19 +112,19 @@
/*
* Define the prototypes for the various APR GP routines.
*/
-API_EXPORT(char *) apr_cpystrn(char *d, const char *s, size_t l);
-/*API_EXPORT(apr_mutex_t *) apr_create_mutex(void *m);*/
-API_EXPORT(int) apr_slack(int l, int h);
-API_EXPORT_NONSTD(int) apr_execle(const char *c, const char *a, ...);
-API_EXPORT_NONSTD(int) apr_execve(const char *c, const char *argv[],
+API_EXPORT(char *) ap_cpystrn(char *d, const char *s, size_t l);
+/*API_EXPORT(ap_mutex_t *) ap_create_mutex(void *m);*/
+API_EXPORT(int) ap_slack(int l, int h);
+API_EXPORT_NONSTD(int) ap_execle(const char *c, const char *a, ...);
+API_EXPORT_NONSTD(int) ap_execve(const char *c, const char *argv[],
const char *envp[]);
-#define apr_create_mutex(x) (0)
-#define apr_release_mutex(x) (0)
-#define apr_acquire_mutex(x) (0)
-#define apr_islower(x) (0)
-#define apr_isalpha(x) (0)
-#define apr_isdigit(x) (0)
+#define ap_create_mutex(x) (0)
+#define ap_release_mutex(x) (0)
+#define ap_acquire_mutex(x) (0)
+#define ap_islower(x) (0)
+#define ap_isalpha(x) (0)
+#define ap_isdigit(x) (0)
/*
* Small utility macros to make things easier to read. Not usually a
@@ -132,17 +132,17 @@
*/
#ifdef WIN32
-#define apr_killpg(x, y)
+#define ap_killpg(x, y)
#else /* WIN32 */
#ifdef NO_KILLPG
-#define apr_killpg(x, y) (kill (-(x), (y)))
+#define ap_killpg(x, y) (kill (-(x), (y)))
#else /* NO_KILLPG */
-#define apr_killpg(x, y) (killpg ((x), (y)))
+#define ap_killpg(x, y) (killpg ((x), (y)))
#endif /* NO_KILLPG */
#endif /* WIN32 */
/*
- * apr_vformatter() is a generic printf-style formatting routine
+ * ap_vformatter() is a generic printf-style formatting routine
* with some extensions. The extensions are:
*
* %pA takes a struct in_addr *, and prints it as a.b.c.d
@@ -155,21 +155,21 @@
* work as expected at all, but that seems to be a fair trade-off
* for the increased robustness of having printf-warnings work.
*
- * Additionally, apr_vformatter allows for arbitrary output methods
- * using the apr_vformatter_buff and flush_func.
+ * Additionally, ap_vformatter allows for arbitrary output methods
+ * using the ap_vformatter_buff and flush_func.
*
- * The apr_vformatter_buff has two elements curpos and endpos.
- * curpos is where apr_vformatter will write the next byte of output.
+ * The ap_vformatter_buff has two elements curpos and endpos.
+ * curpos is where ap_vformatter will write the next byte of output.
* It proceeds writing output to curpos, and updating curpos, until
* either the end of output is reached, or curpos == endpos (i.e. the
* buffer is full).
*
- * If the end of output is reached, apr_vformatter returns the
+ * If the end of output is reached, ap_vformatter returns the
* number of bytes written.
*
* When the buffer is full, the flush_func is called. The flush_func
* can return -1 to indicate that no further output should be attempted,
- * and apr_vformatter will return immediately with -1. Otherwise
+ * and ap_vformatter will return immediately with -1. Otherwise
* the flush_func should flush the buffer in whatever manner is
* appropriate, re-initialize curpos and endpos, and return 0.
*
@@ -177,144 +177,144 @@
* write another byte at curpos when curpos >= endpos. So for
* example, it's possible when the output exactly matches the buffer
* space available that curpos == endpos will be true when
- * apr_vformatter returns.
+ * ap_vformatter returns.
*
- * apr_vformatter does not call out to any other code, it is entirely
+ * ap_vformatter does not call out to any other code, it is entirely
* self-contained. This allows the callers to do things which are
- * otherwise "unsafe". For example, apr_psprintf uses the "scratch"
+ * otherwise "unsafe". For example, ap_psprintf uses the "scratch"
* space at the unallocated end of a block, and doesn't actually
- * complete the allocation until apr_vformatter returns. apr_psprintf
- * would be completely broken if apr_vformatter were to call anything
- * that used a apr_pool_t. Similarly http_bprintf() uses the "scratch"
+ * complete the allocation until ap_vformatter returns. ap_psprintf
+ * would be completely broken if ap_vformatter were to call anything
+ * that used a ap_pool_t. Similarly http_bprintf() uses the "scratch"
* space at the end of its output buffer, and doesn't actually note
* that the space is in use until it either has to flush the buffer
- * or until apr_vformatter returns.
+ * or until ap_vformatter returns.
*/
-API_EXPORT(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b),
- apr_vformatter_buff_t *c, const char *fmt,
+API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff_t *b),
+ ap_vformatter_buff_t *c, const char *fmt,
va_list ap);
/*
- * These are snprintf implementations based on apr_vformatter().
+ * These are snprintf implementations based on ap_vformatter().
*
* Note that various standards and implementations disagree on the return
* value of snprintf, and side-effects due to %n in the formatting string.
- * apr_snprintf behaves as follows:
+ * ap_snprintf behaves as follows:
*
* Process the format string until the entire string is exhausted, or
* the buffer fills. If the buffer fills then stop processing immediately
* (so no further %n arguments are processed), and return the buffer
* length. In all cases the buffer is NUL terminated.
*
- * In no event does apr_snprintf return a negative number. It's not possible
+ * In no event does ap_snprintf return a negative number. It's not possible
* to distinguish between an output which was truncated, and an output which
* exactly filled the buffer.
*/
-API_EXPORT(int) apr_snprintf(char *buf, size_t len, const char *format, ...)
+API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format, ...)
__attribute__((format(printf,3,4)));
-API_EXPORT(int) apr_vsnprintf(char *buf, size_t len, const char *format,
+API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format,
va_list ap);
/*
* APR memory structure manipulators (pools, tables, and arrays).
*/
-API_EXPORT(apr_pool_t *) apr_make_sub_pool(apr_pool_t *p);
-API_EXPORT(void) apr_clear_pool(apr_pool_t *p);
-API_EXPORT(void) apr_destroy_pool(apr_pool_t *p);
-API_EXPORT(long) apr_bytes_in_pool(apr_pool_t *p);
-API_EXPORT(long) apr_bytes_in_free_blocks(void);
-API_EXPORT(apr_pool_t *) apr_find_pool(const void *ts);
-API_EXPORT(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
-API_EXPORT(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
-API_EXPORT(void *) apr_palloc(apr_pool_t *p, int reqsize);
-API_EXPORT(void *) apr_pcalloc(apr_pool_t *p, int size);
-API_EXPORT(char *) apr_pstrdup(apr_pool_t *p, const char *s);
-API_EXPORT(char *) apr_pstrndup(apr_pool_t *p, const char *s, int n);
-API_EXPORT_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...);
-API_EXPORT(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
-API_EXPORT_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...);
-API_EXPORT(apr_array_header_t *) apr_make_array(apr_pool_t *p, int nelts,
+API_EXPORT(ap_pool_t *) ap_make_sub_pool(ap_pool_t *p);
+API_EXPORT(void) ap_clear_pool(ap_pool_t *p);
+API_EXPORT(void) ap_destroy_pool(ap_pool_t *p);
+API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p);
+API_EXPORT(long) ap_bytes_in_free_blocks(void);
+API_EXPORT(ap_pool_t *) ap_find_pool(const void *ts);
+API_EXPORT(int) ap_pool_is_ancestor(ap_pool_t *a, ap_pool_t *b);
+API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub);
+API_EXPORT(void *) ap_palloc(ap_pool_t *p, int reqsize);
+API_EXPORT(void *) ap_pcalloc(ap_pool_t *p, int size);
+API_EXPORT(char *) ap_pstrdup(ap_pool_t *p, const char *s);
+API_EXPORT(char *) ap_pstrndup(ap_pool_t *p, const char *s, int n);
+API_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *p, ...);
+API_EXPORT(char *) ap_pvsprintf(ap_pool_t *p, const char *fmt, va_list ap);
+API_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *p, const char *fmt, ...);
+API_EXPORT(ap_array_header_t *) ap_make_array(ap_pool_t *p, int nelts,
int elt_size);
-API_EXPORT(void *) apr_push_array(apr_array_header_t *arr);
-API_EXPORT(void) apr_array_cat(apr_array_header_t *dst,
- const apr_array_header_t *src);
-API_EXPORT(apr_array_header_t *) apr_copy_array(apr_pool_t *p,
- const apr_array_header_t *arr);
-API_EXPORT(apr_array_header_t *)
- apr_copy_array_hdr(apr_pool_t *p,
- const apr_array_header_t *arr);
-API_EXPORT(apr_array_header_t *)
- apr_append_arrays(apr_pool_t *p,
- const apr_array_header_t *first,
- const apr_array_header_t *second);
-API_EXPORT(char *) apr_array_pstrcat(apr_pool_t *p,
- const apr_array_header_t *arr,
+API_EXPORT(void *) ap_push_array(ap_array_header_t *arr);
+API_EXPORT(void) ap_array_cat(ap_array_header_t *dst,
+ const ap_array_header_t *src);
+API_EXPORT(ap_array_header_t *) ap_copy_array(ap_pool_t *p,
+ const ap_array_header_t *arr);
+API_EXPORT(ap_array_header_t *)
+ ap_copy_array_hdr(ap_pool_t *p,
+ const ap_array_header_t *arr);
+API_EXPORT(ap_array_header_t *)
+ ap_append_arrays(ap_pool_t *p,
+ const ap_array_header_t *first,
+ const ap_array_header_t *second);
+API_EXPORT(char *) ap_array_pstrcat(ap_pool_t *p,
+ const ap_array_header_t *arr,
const char sep);
-API_EXPORT(apr_table_t *) apr_make_table(apr_pool_t *p, int nelts);
-API_EXPORT(apr_table_t *) apr_copy_table(apr_pool_t *p, const apr_table_t *t);
-API_EXPORT(void) apr_clear_table(apr_table_t *t);
-API_EXPORT(const char *) apr_table_get(const apr_table_t *t, const char *key);
-API_EXPORT(void) apr_table_set(apr_table_t *t, const char *key,
+API_EXPORT(ap_table_t *) ap_make_table(ap_pool_t *p, int nelts);
+API_EXPORT(ap_table_t *) ap_copy_table(ap_pool_t *p, const ap_table_t *t);
+API_EXPORT(void) ap_clear_table(ap_table_t *t);
+API_EXPORT(const char *) ap_table_get(const ap_table_t *t, const char *key);
+API_EXPORT(void) ap_table_set(ap_table_t *t, const char *key,
const char *val);
-API_EXPORT(void) apr_table_setn(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_setn(ap_table_t *t, const char *key,
const char *val);
-API_EXPORT(void) apr_table_unset(apr_table_t *t, const char *key);
-API_EXPORT(void) apr_table_merge(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_unset(ap_table_t *t, const char *key);
+API_EXPORT(void) ap_table_merge(ap_table_t *t, const char *key,
const char *val);
-API_EXPORT(void) apr_table_mergen(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_mergen(ap_table_t *t, const char *key,
const char *val);
-API_EXPORT(void) apr_table_add(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_add(ap_table_t *t, const char *key,
const char *val);
-API_EXPORT(void) apr_table_addn(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_addn(ap_table_t *t, const char *key,
const char *val);
-API_EXPORT(apr_table_t *) apr_overlay_tables(apr_pool_t *p,
- const apr_table_t *overlay,
- const apr_table_t *base);
+API_EXPORT(ap_table_t *) ap_overlay_tables(ap_pool_t *p,
+ const ap_table_t *overlay,
+ const ap_table_t *base);
API_EXPORT(void)
- apr_table_do(int (*comp) (void *, const char *, const char *),
- void *rec, const apr_table_t *t, ...);
-API_EXPORT(void) apr_overlap_tables(apr_table_t *a, const apr_table_t *b,
+ ap_table_do(int (*comp) (void *, const char *, const char *),
+ void *rec, const ap_table_t *t, ...);
+API_EXPORT(void) ap_overlap_tables(ap_table_t *a, const ap_table_t *b,
unsigned flags);
-API_EXPORT(void) apr_register_cleanup(apr_pool_t *p, void *data,
- apr_status_t (*plain_cleanup) (void *),
- apr_status_t (*child_cleanup) (void *));
-API_EXPORT(void) apr_kill_cleanup(apr_pool_t *p, void *data,
- apr_status_t (*cleanup) (void *));
-API_EXPORT(void) apr_run_cleanup(apr_pool_t *p, void *data,
- apr_status_t (*cleanup) (void *));
-API_EXPORT(void) apr_cleanup_for_exec(void);
-API_EXPORT_NONSTD(void) apr_null_cleanup(void *data);
-API_EXPORT(void) apr_note_cleanups_for_fd(apr_pool_t *p, int fd);
-API_EXPORT(void) apr_kill_cleanups_for_fd(apr_pool_t *p, int fd);
-API_EXPORT(int) apr_popenf(apr_pool_t *a, const char *name, int flg, int mode);
-API_EXPORT(int) apr_pclosef(apr_pool_t *a, int fd);
-API_EXPORT(void) apr_note_cleanups_for_file(apr_pool_t *p, FILE *fp);
-API_EXPORT(FILE *) apr_pfopen(apr_pool_t *a, const char *name,
+API_EXPORT(void) ap_register_cleanup(ap_pool_t *p, void *data,
+ ap_status_t (*plain_cleanup) (void *),
+ ap_status_t (*child_cleanup) (void *));
+API_EXPORT(void) ap_kill_cleanup(ap_pool_t *p, void *data,
+ ap_status_t (*cleanup) (void *));
+API_EXPORT(void) ap_run_cleanup(ap_pool_t *p, void *data,
+ ap_status_t (*cleanup) (void *));
+API_EXPORT(void) ap_cleanup_for_exec(void);
+API_EXPORT_NONSTD(void) ap_null_cleanup(void *data);
+API_EXPORT(void) ap_note_cleanups_for_fd(ap_pool_t *p, int fd);
+API_EXPORT(void) ap_kill_cleanups_for_fd(ap_pool_t *p, int fd);
+API_EXPORT(int) ap_popenf(ap_pool_t *a, const char *name, int flg, int mode);
+API_EXPORT(int) ap_pclosef(ap_pool_t *a, int fd);
+API_EXPORT(void) ap_note_cleanups_for_file(ap_pool_t *p, FILE *fp);
+API_EXPORT(FILE *) ap_pfopen(ap_pool_t *a, const char *name,
const char *mode);
-API_EXPORT(FILE *) apr_pfdopen(apr_pool_t *a, int fd, const char *mode);
-API_EXPORT(int) apr_pfclose(apr_pool_t *a, FILE *fd);
-API_EXPORT(DIR *) apr_popendir(apr_pool_t *p, const char *name);
-API_EXPORT(void) apr_pclosedir(apr_pool_t *p, DIR * d);
-API_EXPORT(void) apr_note_cleanups_for_socket(apr_pool_t *p, int fd);
-API_EXPORT(void) apr_kill_cleanups_for_socket(apr_pool_t *p, int sock);
-API_EXPORT(int) apr_psocket(apr_pool_t *p, int domain, int type, int protocol);
-API_EXPORT(int) apr_pclosesocket(apr_pool_t *a, int sock);
-API_EXPORT(regex_t *) apr_pregcomp(apr_pool_t *p, const char *pattern,
+API_EXPORT(FILE *) ap_pfdopen(ap_pool_t *a, int fd, const char *mode);
+API_EXPORT(int) ap_pfclose(ap_pool_t *a, FILE *fd);
+API_EXPORT(DIR *) ap_popendir(ap_pool_t *p, const char *name);
+API_EXPORT(void) ap_pclosedir(ap_pool_t *p, DIR * d);
+API_EXPORT(void) ap_note_cleanups_for_socket(ap_pool_t *p, int fd);
+API_EXPORT(void) ap_kill_cleanups_for_socket(ap_pool_t *p, int sock);
+API_EXPORT(int) ap_psocket(ap_pool_t *p, int domain, int type, int protocol);
+API_EXPORT(int) ap_pclosesocket(ap_pool_t *a, int sock);
+API_EXPORT(regex_t *) ap_pregcomp(ap_pool_t *p, const char *pattern,
int cflags);
-API_EXPORT(void) apr_pregfree(apr_pool_t *p, regex_t *reg);
-API_EXPORT(void) apr_note_subprocess(apr_pool_t *a, pid_t pid,
+API_EXPORT(void) ap_pregfree(ap_pool_t *p, regex_t *reg);
+API_EXPORT(void) ap_note_subprocess(ap_pool_t *a, pid_t pid,
enum kill_conditions how);
API_EXPORT(int)
- apr_spawn_child(apr_pool_t *p,
- int (*func) (void *a, apr_child_info_t *c),
+ ap_spawn_child(ap_pool_t *p,
+ int (*func) (void *a, ap_child_info_t *c),
void *data, enum kill_conditions kill_how,
FILE **pipe_in, FILE **pipe_out,
FILE **pipe_err);
#if 0
API_EXPORT(int)
- apr_bspawn_child(apr_pool_t *p,
- int (*func) (void *v, apr_child_info_t *c),
+ ap_bspawn_child(ap_pool_t *p,
+ int (*func) (void *v, ap_child_info_t *c),
void *data, enum kill_conditions kill_how,
BUFF **pipe_in, BUFF **pipe_out, BUFF **pipe_err);
#endif /* 0 */
@@ -323,16 +323,16 @@
* Routine definitions that only work on Windows.
*/
#ifdef WIN32
-API_EXPORT(void) apr_note_cleanups_for_h(apr_pool_t *p, HANDLE hDevice);
-API_EXPORT(int) apr_pcloseh(apr_pool_t *a, HANDLE hDevice);
+API_EXPORT(void) ap_note_cleanups_for_h(ap_pool_t *p, HANDLE hDevice);
+API_EXPORT(int) ap_pcloseh(ap_pool_t *a, HANDLE hDevice);
#endif /* WIN32 */
/*#ifdef TPF*/
-#define apr_block_alarms() (0)
-#define apr_unblock_alarms() (0)
+#define ap_block_alarms() (0)
+#define ap_unblock_alarms() (0)
/*#else
-API_EXPORT(void) apr_block_alarms(void);
-API_EXPORT(void) apr_unblock_alarms(void);
+API_EXPORT(void) ap_block_alarms(void);
+API_EXPORT(void) ap_unblock_alarms(void);
#endif */
#ifdef __cplusplus
1.2 +53 -53 apache-apr/apr/include/apr_pools.h
Index: apr_pools.h
===================================================================
RCS file: /home/cvs/apache-apr/apr/include/apr_pools.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apr_pools.h 1999/04/28 19:20:01 1.1
+++ apr_pools.h 1999/05/10 17:46:19 1.2
@@ -55,8 +55,8 @@
*
*/
-#ifndef APR_POOLS_H
-#define APR_POOLS_H
+#ifndef ap_POOLS_H
+#define ap_POOLS_H
#ifdef __cplusplus
extern "C" {
@@ -95,31 +95,31 @@
struct process_chain *next;
};
-struct apr_pool_t {
+struct ap_pool_t {
union block_hdr *first;
union block_hdr *last;
struct cleanup *cleanups;
struct process_chain *subprocesses;
- apr_pool_t *sub_pools;
- apr_pool_t *sub_next;
- apr_pool_t *sub_prev;
- apr_pool_t *parent;
+ ap_pool_t *sub_pools;
+ ap_pool_t *sub_next;
+ ap_pool_t *sub_prev;
+ ap_pool_t *parent;
char *free_first_avail;
#ifdef ALLOC_USE_MALLOC
void *allocation_list;
#endif
#ifdef POOL_DEBUG
- apr_pool_t *joined;
+ ap_pool_t *joined;
#endif
};
-struct apr_table_t {
+struct ap_table_t {
/* This has to be first to promote backwards compatibility with
- * older modules which cast a apr_table_t * to an apr_array_header_t *...
+ * older modules which cast a ap_table_t * to an ap_array_header_t *...
* they should use the table_elts() function for most of the
* cases they do this for.
*/
- apr_array_header_t a;
+ ap_array_header_t a;
#ifdef MAKE_TABLE_PROFILE
void *creator;
#endif
@@ -135,23 +135,23 @@
* currently being used...
*/
-typedef struct apr_table_entry_t {
+typedef struct ap_table_entry_t {
char *key; /* maybe NULL in future;
* check when iterating thru table_elts
*/
char *val;
-} apr_table_entry_t;
+} ap_table_entry_t;
-apr_pool_t *apr_init_alloc(void); /* Set up everything */
+ap_pool_t *ap_init_alloc(void); /* Set up everything */
/* used to guarantee to the pool debugging code that the sub pool will not be
* destroyed before the parent pool
*/
#ifndef POOL_DEBUG
-#ifdef apr_pool_join
-#undef apr_pool_join
-#endif /* apr_pool_join */
-#define apr_pool_join(a,b)
+#ifdef ap_pool_join
+#undef ap_pool_join
+#endif /* ap_pool_join */
+#define ap_pool_join(a,b)
#endif /* POOL_DEBUG */
/* Clearing out EVERYTHING in an pool... destroys any sub-pools */
@@ -162,14 +162,14 @@
/* routines to allocate memory from an pool... */
-API_EXPORT_NONSTD(char *) apr_psprintf(apr_pool_t *, const char *fmt, ...)
+API_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *, const char *fmt, ...)
__attribute__((format(printf,2,3)));
/* array and alist management... keeping lists of things.
* Common enough to want common support code ...
*/
-/* apr_array_pstrcat generates a new string from the pool containing
+/* ap_array_pstrcat generates a new string from the pool containing
* the concatenated sequence of substrings referenced as elements within
* the array. The string will be empty if all substrings are empty or null,
* or if there are no elements in the array.
@@ -183,18 +183,18 @@
-/* Conceptually, apr_overlap_tables does this:
+/* Conceptually, ap_overlap_tables does this:
- apr_array_header_t *barr = apr_table_elts(b);
- apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
+ ap_array_header_t *barr = ap_table_elts(b);
+ ap_table_entry_t *belt = (ap_table_entry_t *)barr->elts;
int i;
for (i = 0; i < barr->nelts; ++i) {
- if (flags & APR_OVERLAP_TABLES_MERGE) {
- apr_table_mergen(a, belt[i].key, belt[i].val);
+ if (flags & ap_OVERLAP_TABLES_MERGE) {
+ ap_table_mergen(a, belt[i].key, belt[i].val);
}
else {
- apr_table_setn(a, belt[i].key, belt[i].val);
+ ap_table_setn(a, belt[i].key, belt[i].val);
}
}
@@ -205,16 +205,16 @@
in an ancestor of a's pool. In practice b and a are usually from
the same pool.
*/
-#define APR_OVERLAP_TABLES_SET (0)
-#define APR_OVERLAP_TABLES_MERGE (1)
+#define ap_OVERLAP_TABLES_SET (0)
+#define ap_OVERLAP_TABLES_MERGE (1)
/* XXX: these know about the definition of struct table in alloc.c. That
* definition is not here because it is supposed to be private, and by not
* placing it here we are able to get compile-time diagnostics from modules
- * written which assume that a table is the same as an apr_array_header_t. -djg
+ * written which assume that a table is the same as an ap_array_header_t. -djg
*/
-#define apr_table_elts(t) ((apr_array_header_t *)(t))
-#define apr_is_empty_table(t) (((t) == NULL)||(((apr_array_header_t *)(t))->nelts == 0))
+#define ap_table_elts(t) ((ap_array_header_t *)(t))
+#define ap_is_empty_table(t) (((t) == NULL)||(((ap_array_header_t *)(t))->nelts == 0))
/* routines to remember allocation of other sorts of things...
* generic interface first. Note that we want to have two separate
@@ -255,43 +255,43 @@
* the note_cleanups_for_foo routines are for
*/
-API_EXPORT(FILE *) apr_pfopen(apr_pool_t *, const char *name, const char *fmode);
-API_EXPORT(FILE *) apr_pfdopen(apr_pool_t *, int fd, const char *fmode);
-API_EXPORT(int) apr_popenf(apr_pool_t *, const char *name, int flg, int mode);
-
-API_EXPORT(void) apr_note_cleanups_for_file(apr_pool_t *, FILE *);
-API_EXPORT(void) apr_note_cleanups_for_fd(apr_pool_t *, int);
-API_EXPORT(void) apr_kill_cleanups_for_fd(apr_pool_t *p, int fd);
-API_EXPORT(void) apr_note_cleanups_for_socket(apr_pool_t *, int);
-API_EXPORT(void) apr_kill_cleanups_for_socket(apr_pool_t *p, int sock);
-API_EXPORT(int) apr_psocket(apr_pool_t *p, int, int, int);
-API_EXPORT(int) apr_pclosesocket(apr_pool_t *a, int sock);
-API_EXPORT(regex_t *) apr_pregcomp(apr_pool_t *p, const char *pattern,
+API_EXPORT(FILE *) ap_pfopen(ap_pool_t *, const char *name, const char *fmode);
+API_EXPORT(FILE *) ap_pfdopen(ap_pool_t *, int fd, const char *fmode);
+API_EXPORT(int) ap_popenf(ap_pool_t *, const char *name, int flg, int mode);
+
+API_EXPORT(void) ap_note_cleanups_for_file(ap_pool_t *, FILE *);
+API_EXPORT(void) ap_note_cleanups_for_fd(ap_pool_t *, int);
+API_EXPORT(void) ap_kill_cleanups_for_fd(ap_pool_t *p, int fd);
+API_EXPORT(void) ap_note_cleanups_for_socket(ap_pool_t *, int);
+API_EXPORT(void) ap_kill_cleanups_for_socket(ap_pool_t *p, int sock);
+API_EXPORT(int) ap_psocket(ap_pool_t *p, int, int, int);
+API_EXPORT(int) ap_pclosesocket(ap_pool_t *a, int sock);
+API_EXPORT(regex_t *) ap_pregcomp(ap_pool_t *p, const char *pattern,
int cflags);
-API_EXPORT(void) apr_pregfree(apr_pool_t *p, regex_t * reg);
+API_EXPORT(void) ap_pregfree(ap_pool_t *p, regex_t * reg);
/* routines to note closes... file descriptors are constrained enough
* on some systems that we want to support this.
*/
-API_EXPORT(int) apr_pfclose(apr_pool_t *, FILE *);
-API_EXPORT(int) apr_pclosef(apr_pool_t *, int fd);
+API_EXPORT(int) ap_pfclose(ap_pool_t *, FILE *);
+API_EXPORT(int) ap_pclosef(ap_pool_t *, int fd);
/* routines to deal with directories */
-API_EXPORT(DIR *) apr_popendir(apr_pool_t *p, const char *name);
-API_EXPORT(void) apr_pclosedir(apr_pool_t *p, DIR * d);
+API_EXPORT(DIR *) ap_popendir(ap_pool_t *p, const char *name);
+API_EXPORT(void) ap_pclosedir(ap_pool_t *p, DIR * d);
/* ... even child processes (which we may want to wait for,
* or to kill outright, on unexpected termination).
*
- * apr_spawn_child is a utility routine which handles an awful lot of
+ * ap_spawn_child is a utility routine which handles an awful lot of
* the rigamarole associated with spawning a child --- it arranges
* for pipes to the child's stdin and stdout, if desired (if not,
* set the associated args to NULL). It takes as args a function
* to call in the child, and an argument to be passed to the function.
*/
-API_EXPORT(void) apr_note_subprocess(apr_pool_t *a, pid_t pid,
+API_EXPORT(void) ap_note_subprocess(ap_pool_t *a, pid_t pid,
enum kill_conditions how);
/* magic numbers --- min free bytes to consider a free pool block useable,
@@ -306,11 +306,11 @@
/* Finally, some accounting */
-API_EXPORT(long) apr_bytes_in_pool(apr_pool_t *p);
-API_EXPORT(long) apr_bytes_in_free_blocks(void);
+API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p);
+API_EXPORT(long) ap_bytes_in_free_blocks(void);
#ifdef __cplusplus
}
#endif
-#endif /* !APR_POOLS_H */
+#endif /* !ap_POOLS_H */
1.3 +316 -316 apache-apr/apr/lib/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/lib/apr_pools.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- apr_pools.c 1999/04/30 15:19:56 1.2
+++ apr_pools.c 1999/05/10 17:46:21 1.3
@@ -169,7 +169,7 @@
char *first_avail;
#ifdef POOL_DEBUG
union block_hdr *global_next;
- apr_pool_t *owning_pool;
+ ap_pool_t *owning_pool;
#endif /* POOL_DEBUG */
} h;
};
@@ -178,14 +178,14 @@
* Static cells for managing our internal synchronisation.
*/
static union block_hdr *block_freelist = NULL;
-static apr_mutex_t *alloc_mutex = NULL;
-static apr_mutex_t *spawn_mutex = NULL;
+static ap_mutex_t *alloc_mutex = NULL;
+static ap_mutex_t *spawn_mutex = NULL;
#ifdef POOL_DEBUG
static char *known_stack_point;
static int stack_direction;
static union block_hdr *global_block_list;
-#define FREE_POOL ((apr_pool_t *)(-1))
+#define FREE_POOL ((ap_pool_t *)(-1))
#endif /* POOL_DEBUG */
#ifdef ALLOC_STATS
@@ -311,7 +311,7 @@
return; /* Sanity check --- freeing empty pool? */
}
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
old_free_list = block_freelist;
block_freelist = blok;
@@ -359,7 +359,7 @@
num_blocks_freed += num_blocks;
#endif /* ALLOC_STATS */
- (void) apr_release_mutex(alloc_mutex);
+ (void) ap_release_mutex(alloc_mutex);
#endif /* ALLOC_USE_MALLOC */
}
@@ -430,7 +430,7 @@
static void run_cleanups(struct cleanup *c);
static void free_proc_chain(struct process_chain *p);
-static apr_pool_t *permanent_pool;
+static ap_pool_t *permanent_pool;
/* Each pool structure is allocated in the start of its own first block,
* so we need to know how many bytes that is (once properly aligned...).
@@ -439,26 +439,26 @@
* gets taken off the parent's sub-pool list...
*/
-#define POOL_HDR_CLICKS (1 + ((sizeof(struct apr_pool_t) - 1) / CLICK_SZ))
+#define POOL_HDR_CLICKS (1 + ((sizeof(struct ap_pool_t) - 1) / CLICK_SZ))
#define POOL_HDR_BYTES (POOL_HDR_CLICKS * CLICK_SZ)
-API_EXPORT(apr_pool_t *) apr_make_sub_pool(apr_pool_t *p)
+API_EXPORT(ap_pool_t *) ap_make_sub_pool(ap_pool_t *p)
{
union block_hdr *blok;
- apr_pool_t *new_pool;
+ ap_pool_t *new_pool;
- apr_block_alarms();
+ ap_block_alarms();
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
blok = new_block(POOL_HDR_BYTES);
- new_pool = (apr_pool_t *) blok->h.first_avail;
+ new_pool = (ap_pool_t *) blok->h.first_avail;
blok->h.first_avail += POOL_HDR_BYTES;
#ifdef POOL_DEBUG
blok->h.owning_pool = new_pool;
#endif
- memset((char *) new_pool, '\0', sizeof(struct apr_pool_t));
+ memset((char *) new_pool, '\0', sizeof(struct ap_pool_t));
new_pool->free_first_avail = blok->h.first_avail;
new_pool->first = new_pool->last = blok;
@@ -471,8 +471,8 @@
p->sub_pools = new_pool;
}
- (void) apr_release_mutex(alloc_mutex);
- apr_unblock_alarms();
+ (void) ap_release_mutex(alloc_mutex);
+ ap_unblock_alarms();
return new_pool;
}
@@ -506,7 +506,7 @@
}
#endif
-apr_pool_t *apr_init_alloc(void)
+ap_pool_t *ap_init_alloc(void)
{
#ifdef POOL_DEBUG
char s;
@@ -514,9 +514,9 @@
known_stack_point = &s;
stack_var_init(&s);
#endif
- alloc_mutex = apr_create_mutex(NULL);
- spawn_mutex = apr_create_mutex(NULL);
- permanent_pool = apr_make_sub_pool(NULL);
+ alloc_mutex = ap_create_mutex(NULL);
+ spawn_mutex = ap_create_mutex(NULL);
+ permanent_pool = ap_make_sub_pool(NULL);
#ifdef ALLOC_STATS
atexit(dump_stats);
#endif
@@ -524,15 +524,15 @@
return permanent_pool;
}
-API_EXPORT(void) apr_clear_pool(apr_pool_t *a)
+API_EXPORT(void) ap_clear_pool(ap_pool_t *a)
{
- apr_block_alarms();
+ ap_block_alarms();
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
while (a->sub_pools) {
- apr_destroy_pool(a->sub_pools);
+ ap_destroy_pool(a->sub_pools);
}
- (void) apr_release_mutex(alloc_mutex);
+ (void) ap_release_mutex(alloc_mutex);
/*
* Don't hold the mutex during cleanups.
*/
@@ -560,15 +560,15 @@
}
#endif
- apr_unblock_alarms();
+ ap_unblock_alarms();
}
-API_EXPORT(void) apr_destroy_pool(apr_pool_t *a)
+API_EXPORT(void) ap_destroy_pool(ap_pool_t *a)
{
- apr_block_alarms();
- apr_clear_pool(a);
+ ap_block_alarms();
+ ap_clear_pool(a);
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
if (a->parent) {
if (a->parent->sub_pools == a) {
a->parent->sub_pools = a->sub_next;
@@ -580,17 +580,17 @@
a->sub_next->sub_prev = a->sub_prev;
}
}
- (void) apr_release_mutex(alloc_mutex);
+ (void) ap_release_mutex(alloc_mutex);
free_blocks(a->first);
- apr_unblock_alarms();
+ ap_unblock_alarms();
}
-API_EXPORT(long) apr_bytes_in_pool(apr_pool_t *p)
+API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p)
{
return bytes_in_block_list(p->first);
}
-API_EXPORT(long) apr_bytes_in_free_blocks(void)
+API_EXPORT(long) ap_bytes_in_free_blocks(void)
{
return bytes_in_block_list(block_freelist);
}
@@ -613,7 +613,7 @@
/* Find the pool that ts belongs to, return NULL if it doesn't
* belong to any pool.
*/
-API_EXPORT(apr_pool_t *) apr_find_pool(const void *ts)
+API_EXPORT(ap_pool_t *) ap_find_pool(const void *ts)
{
const char *s = ts;
union block_hdr **pb;
@@ -632,7 +632,7 @@
abort();
return NULL;
}
- apr_block_alarms();
+ ap_block_alarms();
/* search the global_block_list */
for (pb = &global_block_list; *pb; pb = &b->h.global_next) {
b = *pb;
@@ -653,18 +653,18 @@
b->h.global_next = global_block_list;
global_block_list = b;
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
return b->h.owning_pool;
}
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
return NULL;
}
/* return TRUE iff a is an ancestor of b
* NULL is considered an ancestor of all pools
*/
-API_EXPORT(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b)
+API_EXPORT(int) ap_pool_is_ancestor(ap_pool_t *a, ap_pool_t *b)
{
if (a == NULL) {
return 1;
@@ -686,7 +686,7 @@
* instead. This is a guarantee by the caller that sub will not
* be destroyed before p is.
*/
-API_EXPORT(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
+API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub)
{
union block_hdr *b;
@@ -695,7 +695,7 @@
fprintf(stderr, "pool_join: p is not parent of sub\n");
abort();
}
- apr_block_alarms();
+ ap_block_alarms();
while (p->joined) {
p = p->joined;
}
@@ -705,7 +705,7 @@
b->h.owning_pool = p;
}
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
}
#endif
@@ -715,13 +715,13 @@
*/
-API_EXPORT(void *) apr_palloc(apr_pool_t *a, int reqsize)
+API_EXPORT(void *) ap_palloc(ap_pool_t *a, int reqsize)
{
#ifdef ALLOC_USE_MALLOC
int size = reqsize + CLICK_SZ;
void *ptr;
- apr_block_alarms();
+ ap_block_alarms();
ptr = malloc(size);
if (ptr == NULL) {
fputs("Ouch! Out of memory!\n", stderr);
@@ -730,7 +730,7 @@
debug_fill(ptr, size); /* might as well get uninitialized protection */
*(void **)ptr = a->allocation_list;
a->allocation_list = ptr;
- apr_unblock_alarms();
+ ap_unblock_alarms();
return (char *)ptr + CLICK_SZ;
#else
@@ -766,9 +766,9 @@
/* Nope --- get a new one that's guaranteed to be big enough */
- apr_block_alarms();
+ ap_block_alarms();
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
blok = new_block(size);
a->last->h.next = blok;
@@ -777,9 +777,9 @@
blok->h.owning_pool = a;
#endif
- (void) apr_release_mutex(alloc_mutex);
+ (void) ap_release_mutex(alloc_mutex);
- apr_unblock_alarms();
+ ap_unblock_alarms();
first_avail = blok->h.first_avail;
blok->h.first_avail += size;
@@ -788,14 +788,14 @@
#endif
}
-API_EXPORT(void *) apr_pcalloc(apr_pool_t *a, int size)
+API_EXPORT(void *) ap_pcalloc(ap_pool_t *a, int size)
{
- void *res = apr_palloc(a, size);
+ void *res = ap_palloc(a, size);
memset(res, '\0', size);
return res;
}
-API_EXPORT(char *) apr_pstrdup(apr_pool_t *a, const char *s)
+API_EXPORT(char *) ap_pstrdup(ap_pool_t *a, const char *s)
{
char *res;
size_t len;
@@ -804,25 +804,25 @@
return NULL;
}
len = strlen(s) + 1;
- res = apr_palloc(a, len);
+ res = ap_palloc(a, len);
memcpy(res, s, len);
return res;
}
-API_EXPORT(char *) apr_pstrndup(apr_pool_t *a, const char *s, int n)
+API_EXPORT(char *) ap_pstrndup(ap_pool_t *a, const char *s, int n)
{
char *res;
if (s == NULL) {
return NULL;
}
- res = apr_palloc(a, n + 1);
+ res = ap_palloc(a, n + 1);
memcpy(res, s, n);
res[n] = '\0';
return res;
}
-API_EXPORT_NONSTD(char *) apr_pstrcat(apr_pool_t *a, ...)
+API_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *a, ...)
{
char *cp, *argp, *res;
@@ -841,7 +841,7 @@
/* Allocate the required string */
- res = (char *) apr_palloc(a, len + 1);
+ res = (char *) ap_palloc(a, len + 1);
cp = res;
*cp = '\0';
@@ -862,21 +862,21 @@
}
/*
- * apr_psprintf is implemented by writing directly into the current
+ * ap_psprintf is implemented by writing directly into the current
* block of the pool, starting right at first_avail. If there's
* insufficient room, then a new block is allocated and the earlier
* output is copied over. The new block isn't linked into the pool
* until all the output is done.
*
* Note that this is completely safe because nothing else can
- * allocate in this pool while apr_psprintf is running. alarms are
+ * allocate in this pool while ap_psprintf is running. alarms are
* blocked, and the only thing outside of alloc.c that's invoked
- * is apr_vformatter -- which was purposefully written to be
+ * is ap_vformatter -- which was purposefully written to be
* self-contained with no callouts.
*/
struct psprintf_data {
- apr_vformatter_buff_t vbuff;
+ ap_vformatter_buff_t vbuff;
#ifdef ALLOC_USE_MALLOC
char *base;
#else
@@ -885,7 +885,7 @@
#endif
};
-static int psprintf_flush(apr_vformatter_buff_t *vbuff)
+static int psprintf_flush(ap_vformatter_buff_t *vbuff)
{
struct psprintf_data *ps = (struct psprintf_data *)vbuff;
#ifdef ALLOC_USE_MALLOC
@@ -913,9 +913,9 @@
cur_len = strp - blok->h.first_avail;
/* must try another blok */
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
nblok = new_block(2 * cur_len);
- (void) apr_release_mutex(alloc_mutex);
+ (void) ap_release_mutex(alloc_mutex);
memcpy(nblok->h.first_avail, blok->h.first_avail, cur_len);
ps->vbuff.curpos = nblok->h.first_avail + cur_len;
/* save a byte for the NUL terminator */
@@ -924,10 +924,10 @@
/* did we allocate the current blok? if so free it up */
if (ps->got_a_new_block) {
debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail);
- (void) apr_acquire_mutex(alloc_mutex);
+ (void) ap_acquire_mutex(alloc_mutex);
blok->h.next = block_freelist;
block_freelist = blok;
- (void) apr_release_mutex(alloc_mutex);
+ (void) ap_release_mutex(alloc_mutex);
}
ps->blok = nblok;
ps->got_a_new_block = 1;
@@ -939,13 +939,13 @@
#endif
}
-API_EXPORT(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap)
+API_EXPORT(char *) ap_pvsprintf(ap_pool_t *p, const char *fmt, va_list ap)
{
#ifdef ALLOC_USE_MALLOC
struct psprintf_data ps;
void *ptr;
- apr_block_alarms();
+ ap_block_alarms();
ps.base = malloc(512);
if (ps.base == NULL) {
fputs("Ouch! Out of memory!\n", stderr);
@@ -954,7 +954,7 @@
/* need room at beginning for allocation_list */
ps.vbuff.curpos = ps.base + CLICK_SZ;
ps.vbuff.endpos = ps.base + 511;
- apr_vformatter(psprintf_flush, &ps.vbuff, fmt, ap);
+ ap_vformatter(psprintf_flush, &ps.vbuff, fmt, ap);
*ps.vbuff.curpos++ = '\0';
ptr = ps.base;
/* shrink */
@@ -965,20 +965,20 @@
}
*(void **)ptr = p->allocation_list;
p->allocation_list = ptr;
- apr_unblock_alarms();
+ ap_unblock_alarms();
return (char *)ptr + CLICK_SZ;
#else
struct psprintf_data ps;
char *strp;
int size;
- apr_block_alarms();
+ ap_block_alarms();
ps.blok = p->last;
ps.vbuff.curpos = ps.blok->h.first_avail;
ps.vbuff.endpos = ps.blok->h.endp - 1; /* save one for NUL */
ps.got_a_new_block = 0;
- apr_vformatter(psprintf_flush, &ps.vbuff, fmt, ap);
+ ap_vformatter(psprintf_flush, &ps.vbuff, fmt, ap);
strp = ps.vbuff.curpos;
*strp++ = '\0';
@@ -996,19 +996,19 @@
ps.blok->h.owning_pool = p;
#endif
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
return strp;
#endif
}
-API_EXPORT_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
+API_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *p, const char *fmt, ...)
{
va_list ap;
char *res;
va_start(ap, fmt);
- res = apr_pvsprintf(p, fmt, ap);
+ res = ap_pvsprintf(p, fmt, ap);
va_end(ap);
return res;
}
@@ -1018,7 +1018,7 @@
* The 'array' functions...
*/
-static void make_array_core(apr_array_header_t *res, apr_pool_t *p,
+static void make_array_core(ap_array_header_t *res, ap_pool_t *p,
int nelts, int elt_size)
{
/*
@@ -1029,7 +1029,7 @@
nelts = 1;
}
- res->elts = apr_pcalloc(p, nelts * elt_size);
+ res->elts = ap_pcalloc(p, nelts * elt_size);
res->pool = p;
res->elt_size = elt_size;
@@ -1037,23 +1037,23 @@
res->nalloc = nelts; /* ...but this many allocated */
}
-API_EXPORT(apr_array_header_t *) apr_make_array(apr_pool_t *p,
+API_EXPORT(ap_array_header_t *) ap_make_array(ap_pool_t *p,
int nelts, int elt_size)
{
- apr_array_header_t *res;
+ ap_array_header_t *res;
- res = (apr_array_header_t *) apr_palloc(p, sizeof(apr_array_header_t));
+ res = (ap_array_header_t *) ap_palloc(p, sizeof(ap_array_header_t));
make_array_core(res, p, nelts, elt_size);
return res;
}
-API_EXPORT(void *) apr_push_array(apr_array_header_t *arr)
+API_EXPORT(void *) ap_push_array(ap_array_header_t *arr)
{
if (arr->nelts == arr->nalloc) {
int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2;
char *new_data;
- new_data = apr_pcalloc(arr->pool, arr->elt_size * new_size);
+ new_data = ap_pcalloc(arr->pool, arr->elt_size * new_size);
memcpy(new_data, arr->elts, arr->nalloc * arr->elt_size);
arr->elts = new_data;
@@ -1064,8 +1064,8 @@
return arr->elts + (arr->elt_size * (arr->nelts - 1));
}
-API_EXPORT(void) apr_array_cat(apr_array_header_t *dst,
- const apr_array_header_t *src)
+API_EXPORT(void) ap_array_cat(ap_array_header_t *dst,
+ const ap_array_header_t *src)
{
int elt_size = dst->elt_size;
@@ -1077,7 +1077,7 @@
new_size *= 2;
}
- new_data = apr_pcalloc(dst->pool, elt_size * new_size);
+ new_data = ap_pcalloc(dst->pool, elt_size * new_size);
memcpy(new_data, dst->elts, dst->nalloc * elt_size);
dst->elts = new_data;
@@ -1089,10 +1089,10 @@
dst->nelts += src->nelts;
}
-API_EXPORT(apr_array_header_t *) apr_copy_array(apr_pool_t *p,
- const apr_array_header_t *arr)
+API_EXPORT(ap_array_header_t *) ap_copy_array(ap_pool_t *p,
+ const ap_array_header_t *arr)
{
- apr_array_header_t *res = apr_make_array(p, arr->nalloc, arr->elt_size);
+ ap_array_header_t *res = ap_make_array(p, arr->nalloc, arr->elt_size);
memcpy(res->elts, arr->elts, arr->elt_size * arr->nelts);
res->nelts = arr->nelts;
@@ -1106,8 +1106,8 @@
* overhead of the full copy only where it is really needed.
*/
-static APR_INLINE void copy_array_hdr_core(apr_array_header_t *res,
- const apr_array_header_t *arr)
+static APR_INLINE void copy_array_hdr_core(ap_array_header_t *res,
+ const ap_array_header_t *arr)
{
res->elts = arr->elts;
res->elt_size = arr->elt_size;
@@ -1115,13 +1115,13 @@
res->nalloc = arr->nelts; /* Force overflow on push */
}
-API_EXPORT(apr_array_header_t *)
- apr_copy_array_hdr(apr_pool_t *p,
- const apr_array_header_t *arr)
+API_EXPORT(ap_array_header_t *)
+ ap_copy_array_hdr(ap_pool_t *p,
+ const ap_array_header_t *arr)
{
- apr_array_header_t *res;
+ ap_array_header_t *res;
- res = (apr_array_header_t *) apr_palloc(p, sizeof(apr_array_header_t));
+ res = (ap_array_header_t *) ap_palloc(p, sizeof(ap_array_header_t));
res->pool = p;
copy_array_hdr_core(res, arr);
return res;
@@ -1129,32 +1129,32 @@
/* The above is used here to avoid consing multiple new array bodies... */
-API_EXPORT(apr_array_header_t *)
- apr_append_arrays(apr_pool_t *p,
- const apr_array_header_t *first,
- const apr_array_header_t *second)
+API_EXPORT(ap_array_header_t *)
+ ap_append_arrays(ap_pool_t *p,
+ const ap_array_header_t *first,
+ const ap_array_header_t *second)
{
- apr_array_header_t *res = apr_copy_array_hdr(p, first);
+ ap_array_header_t *res = ap_copy_array_hdr(p, first);
- apr_array_cat(res, second);
+ ap_array_cat(res, second);
return res;
}
-/* apr_array_pstrcat generates a new string from the pool containing
+/* ap_array_pstrcat generates a new string from the pool containing
* the concatenated sequence of substrings referenced as elements within
* the array. The string will be empty if all substrings are empty or null,
* or if there are no elements in the array.
* If sep is non-NUL, it will be inserted between elements as a separator.
*/
-API_EXPORT(char *) apr_array_pstrcat(apr_pool_t *p,
- const apr_array_header_t *arr,
+API_EXPORT(char *) ap_array_pstrcat(ap_pool_t *p,
+ const ap_array_header_t *arr,
const char sep)
{
char *cp, *res, **strpp;
int i, len;
if (arr->nelts <= 0 || arr->elts == NULL) { /* Empty table? */
- return (char *) apr_pcalloc(p, 1);
+ return (char *) ap_pcalloc(p, 1);
}
/* Pass one --- find length of required string */
@@ -1174,7 +1174,7 @@
/* Allocate the required string */
- res = (char *) apr_palloc(p, len + 1);
+ res = (char *) ap_palloc(p, len + 1);
cp = res;
/* Pass two --- copy the argument strings into the result space */
@@ -1211,58 +1211,58 @@
* in alloc.h
*/
#ifdef MAKE_TABLE_PROFILE
-static apr_table_entry_t *table_push(apr_table_t *t)
+static ap_table_entry_t *table_push(ap_table_t *t)
{
if (t->a.nelts == t->a.nalloc) {
fprintf(stderr,
"table_push: table created by %p hit limit of %u\n",
t->creator, t->a.nalloc);
}
- return (apr_table_entry_t *) apr_push_array(&t->a);
+ return (ap_table_entry_t *) ap_push_array(&t->a);
}
#else /* MAKE_TABLE_PROFILE */
-#define table_push(t) ((apr_table_entry_t *) apr_push_array(&(t)->a))
+#define table_push(t) ((ap_table_entry_t *) ap_push_array(&(t)->a))
#endif /* MAKE_TABLE_PROFILE */
-API_EXPORT(apr_table_t *) apr_make_table(apr_pool_t *p, int nelts)
+API_EXPORT(ap_table_t *) ap_make_table(ap_pool_t *p, int nelts)
{
- apr_table_t *t = apr_palloc(p, sizeof(apr_table_t));
+ ap_table_t *t = ap_palloc(p, sizeof(ap_table_t));
- make_array_core(&t->a, p, nelts, sizeof(apr_table_entry_t));
+ make_array_core(&t->a, p, nelts, sizeof(ap_table_entry_t));
#ifdef MAKE_TABLE_PROFILE
t->creator = __builtin_return_address(0);
#endif
return t;
}
-API_EXPORT(apr_table_t *) apr_copy_table(apr_pool_t *p, const apr_table_t *t)
+API_EXPORT(ap_table_t *) ap_copy_table(ap_pool_t *p, const ap_table_t *t)
{
- apr_table_t *new = apr_palloc(p, sizeof(apr_table_t));
+ ap_table_t *new = ap_palloc(p, sizeof(ap_table_t));
#ifdef POOL_DEBUG
/* we don't copy keys and values, so it's necessary that t->a.pool
* have a life span at least as long as p
*/
- if (!apr_pool_is_ancestor(t->a.pool, p)) {
+ if (!ap_pool_is_ancestor(t->a.pool, p)) {
fprintf(stderr, "copy_table: t's pool is not an ancestor of p\n");
abort();
}
#endif
- make_array_core(&new->a, p, t->a.nalloc, sizeof(apr_table_entry_t));
- memcpy(new->a.elts, t->a.elts, t->a.nelts * sizeof(apr_table_entry_t));
+ make_array_core(&new->a, p, t->a.nalloc, sizeof(ap_table_entry_t));
+ memcpy(new->a.elts, t->a.elts, t->a.nelts * sizeof(ap_table_entry_t));
new->a.nelts = t->a.nelts;
return new;
}
-API_EXPORT(void) apr_clear_table(apr_table_t *t)
+API_EXPORT(void) ap_clear_table(ap_table_t *t)
{
t->a.nelts = 0;
}
-API_EXPORT(const char *) apr_table_get(const apr_table_t *t, const char *key)
+API_EXPORT(const char *) ap_table_get(const ap_table_t *t, const char *key)
{
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
int i;
if (key == NULL) {
@@ -1278,17 +1278,17 @@
return NULL;
}
-API_EXPORT(void) apr_table_set(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_set(ap_table_t *t, const char *key,
const char *val)
{
register int i, j, k;
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
int done = 0;
for (i = 0; i < t->a.nelts; ) {
if (!strcasecmp(elts[i].key, key)) {
if (!done) {
- elts[i].val = apr_pstrdup(t->a.pool, val);
+ elts[i].val = ap_pstrdup(t->a.pool, val);
done = 1;
++i;
}
@@ -1306,26 +1306,26 @@
}
if (!done) {
- elts = (apr_table_entry_t *) table_push(t);
- elts->key = apr_pstrdup(t->a.pool, key);
- elts->val = apr_pstrdup(t->a.pool, val);
+ elts = (ap_table_entry_t *) table_push(t);
+ elts->key = ap_pstrdup(t->a.pool, key);
+ elts->val = ap_pstrdup(t->a.pool, val);
}
}
-API_EXPORT(void) apr_table_setn(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_setn(ap_table_t *t, const char *key,
const char *val)
{
register int i, j, k;
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
int done = 0;
#ifdef POOL_DEBUG
{
- if (!apr_pool_is_ancestor(apr_find_pool(key), t->a.pool)) {
+ if (!ap_pool_is_ancestor(ap_find_pool(key), t->a.pool)) {
fprintf(stderr, "table_set: key not in ancestor pool of t\n");
abort();
}
- if (!apr_pool_is_ancestor(apr_find_pool(val), t->a.pool)) {
+ if (!ap_pool_is_ancestor(ap_find_pool(val), t->a.pool)) {
fprintf(stderr, "table_set: val not in ancestor pool of t\n");
abort();
}
@@ -1353,16 +1353,16 @@
}
if (!done) {
- elts = (apr_table_entry_t *) table_push(t);
+ elts = (ap_table_entry_t *) table_push(t);
elts->key = (char *)key;
elts->val = (char *)val;
}
}
-API_EXPORT(void) apr_table_unset(apr_table_t *t, const char *key)
+API_EXPORT(void) ap_table_unset(ap_table_t *t, const char *key)
{
register int i, j, k;
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
for (i = 0; i < t->a.nelts; ) {
if (!strcasecmp(elts[i].key, key)) {
@@ -1384,37 +1384,37 @@
}
}
-API_EXPORT(void) apr_table_merge(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_merge(ap_table_t *t, const char *key,
const char *val)
{
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
int i;
for (i = 0; i < t->a.nelts; ++i) {
if (!strcasecmp(elts[i].key, key)) {
- elts[i].val = apr_pstrcat(t->a.pool, elts[i].val, ", ", val, NULL);
+ elts[i].val = ap_pstrcat(t->a.pool, elts[i].val, ", ", val, NULL);
return;
}
}
- elts = (apr_table_entry_t *) table_push(t);
- elts->key = apr_pstrdup(t->a.pool, key);
- elts->val = apr_pstrdup(t->a.pool, val);
+ elts = (ap_table_entry_t *) table_push(t);
+ elts->key = ap_pstrdup(t->a.pool, key);
+ elts->val = ap_pstrdup(t->a.pool, val);
}
-API_EXPORT(void) apr_table_mergen(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_mergen(ap_table_t *t, const char *key,
const char *val)
{
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
int i;
#ifdef POOL_DEBUG
{
- if (!apr_pool_is_ancestor(apr_find_pool(key), t->a.pool)) {
+ if (!ap_pool_is_ancestor(ap_find_pool(key), t->a.pool)) {
fprintf(stderr, "table_set: key not in ancestor pool of t\n");
abort();
}
- if (!apr_pool_is_ancestor(apr_find_pool(val), t->a.pool)) {
+ if (!ap_pool_is_ancestor(ap_find_pool(val), t->a.pool)) {
fprintf(stderr, "table_set: key not in ancestor pool of t\n");
abort();
}
@@ -1423,77 +1423,77 @@
for (i = 0; i < t->a.nelts; ++i) {
if (!strcasecmp(elts[i].key, key)) {
- elts[i].val = apr_pstrcat(t->a.pool, elts[i].val, ", ", val, NULL);
+ elts[i].val = ap_pstrcat(t->a.pool, elts[i].val, ", ", val, NULL);
return;
}
}
- elts = (apr_table_entry_t *) table_push(t);
+ elts = (ap_table_entry_t *) table_push(t);
elts->key = (char *)key;
elts->val = (char *)val;
}
-API_EXPORT(void) apr_table_add(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_add(ap_table_t *t, const char *key,
const char *val)
{
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
- elts = (apr_table_entry_t *) table_push(t);
- elts->key = apr_pstrdup(t->a.pool, key);
- elts->val = apr_pstrdup(t->a.pool, val);
+ elts = (ap_table_entry_t *) table_push(t);
+ elts->key = ap_pstrdup(t->a.pool, key);
+ elts->val = ap_pstrdup(t->a.pool, val);
}
-API_EXPORT(void) apr_table_addn(apr_table_t *t, const char *key,
+API_EXPORT(void) ap_table_addn(ap_table_t *t, const char *key,
const char *val)
{
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
#ifdef POOL_DEBUG
{
- if (!apr_pool_is_ancestor(apr_find_pool(key), t->a.pool)) {
+ if (!ap_pool_is_ancestor(ap_find_pool(key), t->a.pool)) {
fprintf(stderr, "table_set: key not in ancestor pool of t\n");
abort();
}
- if (!apr_pool_is_ancestor(apr_find_pool(val), t->a.pool)) {
+ if (!ap_pool_is_ancestor(ap_find_pool(val), t->a.pool)) {
fprintf(stderr, "table_set: key not in ancestor pool of t\n");
abort();
}
}
#endif
- elts = (apr_table_entry_t *) table_push(t);
+ elts = (ap_table_entry_t *) table_push(t);
elts->key = (char *)key;
elts->val = (char *)val;
}
-API_EXPORT(apr_table_t *) apr_overlay_tables(apr_pool_t *p,
- const apr_table_t *overlay,
- const apr_table_t *base)
+API_EXPORT(ap_table_t *) ap_overlay_tables(ap_pool_t *p,
+ const ap_table_t *overlay,
+ const ap_table_t *base)
{
- apr_table_t *res;
+ ap_table_t *res;
#ifdef POOL_DEBUG
/* we don't copy keys and values, so it's necessary that
* overlay->a.pool and base->a.pool have a life span at least
* as long as p
*/
- if (!apr_pool_is_ancestor(overlay->a.pool, p)) {
+ if (!ap_pool_is_ancestor(overlay->a.pool, p)) {
fprintf(stderr,
"overlay_tables: overlay's pool is not an ancestor of p\n");
abort();
}
- if (!apr_pool_is_ancestor(base->a.pool, p)) {
+ if (!ap_pool_is_ancestor(base->a.pool, p)) {
fprintf(stderr,
"overlay_tables: base's pool is not an ancestor of p\n");
abort();
}
#endif
- res = apr_palloc(p, sizeof(apr_table_t));
+ res = ap_palloc(p, sizeof(ap_table_t));
/* behave like append_arrays */
res->a.pool = p;
copy_array_hdr_core(&res->a, &overlay->a);
- apr_array_cat(&res->a, &base->a);
+ ap_array_cat(&res->a, &base->a);
return res;
}
@@ -1520,12 +1520,12 @@
* Note that rec is simply passed-on to the comp function, so that the
* caller can pass additional info for the task.
*/
-API_EXPORT(void) apr_table_do(int (*comp) (void *, const char *, const char *),
- void *rec, const apr_table_t *t, ...)
+API_EXPORT(void) ap_table_do(int (*comp) (void *, const char *, const char *),
+ void *rec, const ap_table_t *t, ...)
{
va_list vp;
char *argp;
- apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts;
+ ap_table_entry_t *elts = (ap_table_entry_t *) t->a.elts;
int rv, i;
va_start(vp, t);
@@ -1571,31 +1571,31 @@
}
/* prefer to use the stack for temp storage for overlaps smaller than this */
-#ifndef APR_OVERLAP_TABLES_ON_STACK
-#define APR_OVERLAP_TABLES_ON_STACK (512)
+#ifndef ap_OVERLAP_TABLES_ON_STACK
+#define ap_OVERLAP_TABLES_ON_STACK (512)
#endif
-API_EXPORT(void) apr_overlap_tables(apr_table_t *a, const apr_table_t *b,
+API_EXPORT(void) ap_overlap_tables(ap_table_t *a, const ap_table_t *b,
unsigned flags)
{
- overlap_key cat_keys_buf[APR_OVERLAP_TABLES_ON_STACK];
+ overlap_key cat_keys_buf[ap_OVERLAP_TABLES_ON_STACK];
overlap_key *cat_keys;
int nkeys;
- apr_table_entry_t *e;
- apr_table_entry_t *last_e;
+ ap_table_entry_t *e;
+ ap_table_entry_t *last_e;
overlap_key *left;
overlap_key *right;
overlap_key *last;
nkeys = a->a.nelts + b->a.nelts;
- if (nkeys < APR_OVERLAP_TABLES_ON_STACK) {
+ if (nkeys < ap_OVERLAP_TABLES_ON_STACK) {
cat_keys = cat_keys_buf;
}
else {
/* XXX: could use scratch free space in a or b's pool instead...
* which could save an allocation in b's pool.
*/
- cat_keys = apr_palloc(b->a.pool, sizeof(overlap_key) * nkeys);
+ cat_keys = ap_palloc(b->a.pool, sizeof(overlap_key) * nkeys);
}
nkeys = 0;
@@ -1603,7 +1603,7 @@
/* Create a list of the entries from a concatenated with the entries
* from b.
*/
- e = (apr_table_entry_t *)a->a.elts;
+ e = (ap_table_entry_t *)a->a.elts;
last_e = e + a->a.nelts;
while (e < last_e) {
cat_keys[nkeys].key = e->key;
@@ -1613,7 +1613,7 @@
++e;
}
- e = (apr_table_entry_t *)b->a.elts;
+ e = (ap_table_entry_t *)b->a.elts;
last_e = e + b->a.nelts;
while (e < last_e) {
cat_keys[nkeys].key = e->key;
@@ -1630,7 +1630,7 @@
*/
a->a.nelts = 0;
if (a->a.nalloc < nkeys) {
- a->a.elts = apr_palloc(a->a.pool, a->a.elt_size * nkeys * 2);
+ a->a.elts = ap_palloc(a->a.pool, a->a.elt_size * nkeys * 2);
a->a.nalloc = nkeys * 2;
}
@@ -1645,14 +1645,14 @@
* appropriate.
*/
- if (flags & APR_OVERLAP_TABLES_MERGE) {
+ if (flags & ap_OVERLAP_TABLES_MERGE) {
left = cat_keys;
last = left + nkeys;
while (left < last) {
right = left + 1;
if (right == last
|| strcasecmp(left->key, right->key)) {
- apr_table_addn(a, left->key, left->val);
+ ap_table_addn(a, left->key, left->val);
left = right;
}
else {
@@ -1672,7 +1672,7 @@
} while (right < last
&& !strcasecmp(left->key, right->key));
/* right points one past the last header to merge */
- value = apr_palloc(a->a.pool, len + 1);
+ value = ap_palloc(a->a.pool, len + 1);
strp = value;
for (;;) {
memcpy(strp, left->val, left->order);
@@ -1685,7 +1685,7 @@
*strp++ = ' ';
}
*strp = 0;
- apr_table_addn(a, (left-1)->key, value);
+ ap_table_addn(a, (left-1)->key, value);
}
}
}
@@ -1697,7 +1697,7 @@
while (right < last && !strcasecmp(left->key, right->key)) {
++right;
}
- apr_table_addn(a, (right-1)->key, (right-1)->val);
+ ap_table_addn(a, (right-1)->key, (right-1)->val);
left = right;
}
}
@@ -1710,18 +1710,18 @@
struct cleanup {
void *data;
- apr_status_t (*plain_cleanup) (void *);
- apr_status_t (*child_cleanup) (void *);
+ ap_status_t (*plain_cleanup) (void *);
+ ap_status_t (*child_cleanup) (void *);
struct cleanup *next;
};
-API_EXPORT(void) apr_register_cleanup(apr_pool_t *p, void *data,
- apr_status_t (*plain_cleanup) (void *),
- apr_status_t (*child_cleanup) (void *))
+API_EXPORT(void) ap_register_cleanup(ap_pool_t *p, void *data,
+ ap_status_t (*plain_cleanup) (void *),
+ ap_status_t (*child_cleanup) (void *))
{
struct cleanup *c;
- c = (struct cleanup *) apr_palloc(p, sizeof(struct cleanup));
+ c = (struct cleanup *) ap_palloc(p, sizeof(struct cleanup));
c->data = data;
c->plain_cleanup = plain_cleanup;
c->child_cleanup = child_cleanup;
@@ -1729,8 +1729,8 @@
p->cleanups = c;
}
-API_EXPORT(void) apr_kill_cleanup(apr_pool_t *p, void *data,
- apr_status_t (*cleanup) (void *))
+API_EXPORT(void) ap_kill_cleanup(ap_pool_t *p, void *data,
+ ap_status_t (*cleanup) (void *))
{
struct cleanup *c = p->cleanups;
struct cleanup **lastp = &p->cleanups;
@@ -1746,13 +1746,13 @@
}
}
-API_EXPORT(void) apr_run_cleanup(apr_pool_t *p, void *data,
- apr_status_t (*cleanup) (void *))
+API_EXPORT(void) ap_run_cleanup(ap_pool_t *p, void *data,
+ ap_status_t (*cleanup) (void *))
{
- apr_block_alarms(); /* Run cleanup only once! */
+ ap_block_alarms(); /* Run cleanup only once! */
(*cleanup) (data);
- apr_kill_cleanup(p, data, cleanup);
- apr_unblock_alarms();
+ ap_kill_cleanup(p, data, cleanup);
+ ap_unblock_alarms();
}
static void run_cleanups(struct cleanup *c)
@@ -1771,7 +1771,7 @@
}
}
-static void cleanup_pool_for_exec(apr_pool_t *p)
+static void cleanup_pool_for_exec(ap_pool_t *p)
{
run_child_cleanups(p->cleanups);
p->cleanups = NULL;
@@ -1781,7 +1781,7 @@
}
}
-API_EXPORT(void) apr_cleanup_for_exec(void)
+API_EXPORT(void) ap_cleanup_for_exec(void)
{
#if !defined(WIN32) && !defined(OS2)
/*
@@ -1793,13 +1793,13 @@
* I can do about that (except if the child decides
* to go out and close them
*/
- apr_block_alarms();
+ ap_block_alarms();
cleanup_pool_for_exec(permanent_pool);
- apr_unblock_alarms();
+ ap_unblock_alarms();
#endif /* ndef WIN32 */
}
-API_EXPORT_NONSTD(void) apr_null_cleanup(void *data)
+API_EXPORT_NONSTD(void) ap_null_cleanup(void *data)
{
/* do nothing cleanup routine */
}
@@ -1815,43 +1815,43 @@
close((int) (long) fdv);
}
-API_EXPORT(void) apr_note_cleanups_for_fd(apr_pool_t *p, int fd)
+API_EXPORT(void) ap_note_cleanups_for_fd(ap_pool_t *p, int fd)
{
- apr_register_cleanup(p, (void *) (long) fd, fd_cleanup, fd_cleanup);
+ ap_register_cleanup(p, (void *) (long) fd, fd_cleanup, fd_cleanup);
}
-API_EXPORT(void) apr_kill_cleanups_for_fd(apr_pool_t *p, int fd)
+API_EXPORT(void) ap_kill_cleanups_for_fd(ap_pool_t *p, int fd)
{
- apr_kill_cleanup(p, (void *) (long) fd, fd_cleanup);
+ ap_kill_cleanup(p, (void *) (long) fd, fd_cleanup);
}
-API_EXPORT(int) apr_popenf(apr_pool_t *a, const char *name, int flg, int mode)
+API_EXPORT(int) ap_popenf(ap_pool_t *a, const char *name, int flg, int mode)
{
int fd;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
fd = open(name, flg, mode);
save_errno = errno;
if (fd >= 0) {
- fd = apr_slack(fd, APR_SLACK_HIGH);
- apr_note_cleanups_for_fd(a, fd);
+ fd = ap_slack(fd, ap_SLACK_HIGH);
+ ap_note_cleanups_for_fd(a, fd);
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = save_errno;
return fd;
}
-API_EXPORT(int) apr_pclosef(apr_pool_t *a, int fd)
+API_EXPORT(int) ap_pclosef(ap_pool_t *a, int fd)
{
int res;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
res = close(fd);
save_errno = errno;
- apr_kill_cleanup(a, (void *) (long) fd, fd_cleanup);
- apr_unblock_alarms();
+ ap_kill_cleanup(a, (void *) (long) fd, fd_cleanup);
+ ap_unblock_alarms();
errno = save_errno;
return res;
}
@@ -1862,25 +1862,25 @@
CloseHandle((HANDLE) fdv);
}
-API_EXPORT(void) apr_note_cleanups_for_h(apr_pool_t *p, HANDLE hDevice)
+API_EXPORT(void) ap_note_cleanups_for_h(ap_pool_t *p, HANDLE hDevice)
{
- apr_register_cleanup(p, (void *) hDevice, h_cleanup, h_cleanup);
+ ap_register_cleanup(p, (void *) hDevice, h_cleanup, h_cleanup);
}
-API_EXPORT(int) apr_pcloseh(apr_pool_t *a, HANDLE hDevice)
+API_EXPORT(int) ap_pcloseh(ap_pool_t *a, HANDLE hDevice)
{
int res=0;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
if (!CloseHandle(hDevice)) {
res = GetLastError();
}
save_errno = errno;
- apr_kill_cleanup(a, (void *) hDevice, h_cleanup);
- apr_unblock_alarms();
+ ap_kill_cleanup(a, (void *) hDevice, h_cleanup);
+ ap_unblock_alarms();
errno = save_errno;
return res;
}
@@ -1900,12 +1900,12 @@
close(fileno((FILE *) fpv));
}
-API_EXPORT(void) apr_note_cleanups_for_file(apr_pool_t *p, FILE *fp)
+API_EXPORT(void) ap_note_cleanups_for_file(ap_pool_t *p, FILE *fp)
{
- apr_register_cleanup(p, (void *) fp, file_cleanup, file_child_cleanup);
+ ap_register_cleanup(p, (void *) fp, file_cleanup, file_child_cleanup);
}
-API_EXPORT(FILE *) apr_pfopen(apr_pool_t *a, const char *name,
+API_EXPORT(FILE *) ap_pfopen(ap_pool_t *a, const char *name,
const char *mode)
{
FILE *fd = NULL;
@@ -1919,7 +1919,7 @@
modeFlags = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
#endif
- apr_block_alarms();
+ ap_block_alarms();
if (*mode == 'a') {
/* Work around faulty implementations of fopen */
@@ -1927,8 +1927,8 @@
desc = open(name, baseFlag | O_APPEND | O_CREAT,
modeFlags);
if (desc >= 0) {
- desc = apr_slack(desc, APR_SLACK_LOW);
- fd = apr_fdopen(desc, mode);
+ desc = ap_slack(desc, ap_SLACK_LOW);
+ fd = ap_fdopen(desc, mode);
}
}
else {
@@ -1936,38 +1936,38 @@
}
saved_errno = errno;
if (fd != NULL) {
- apr_note_cleanups_for_file(a, fd);
+ ap_note_cleanups_for_file(a, fd);
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = saved_errno;
return fd;
}
-API_EXPORT(FILE *) apr_pfdopen(apr_pool_t *a, int fd, const char *mode)
+API_EXPORT(FILE *) ap_pfdopen(ap_pool_t *a, int fd, const char *mode)
{
FILE *f;
int saved_errno;
- apr_block_alarms();
- f = apr_fdopen(fd, mode);
+ ap_block_alarms();
+ f = ap_fdopen(fd, mode);
saved_errno = errno;
if (f != NULL) {
- apr_note_cleanups_for_file(a, f);
+ ap_note_cleanups_for_file(a, f);
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = saved_errno;
return f;
}
-API_EXPORT(int) apr_pfclose(apr_pool_t *a, FILE *fd)
+API_EXPORT(int) ap_pfclose(ap_pool_t *a, FILE *fd)
{
int res;
- apr_block_alarms();
+ ap_block_alarms();
res = fclose(fd);
- apr_kill_cleanup(a, (void *) fd, file_cleanup);
- apr_unblock_alarms();
+ ap_kill_cleanup(a, (void *) fd, file_cleanup);
+ ap_unblock_alarms();
return res;
}
@@ -1980,30 +1980,30 @@
closedir((DIR *) dv);
}
-API_EXPORT(DIR *) apr_popendir(apr_pool_t *p, const char *name)
+API_EXPORT(DIR *) ap_popendir(ap_pool_t *p, const char *name)
{
DIR *d;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
d = opendir(name);
if (d == NULL) {
save_errno = errno;
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = save_errno;
return NULL;
}
- apr_register_cleanup(p, (void *) d, dir_cleanup, dir_cleanup);
- apr_unblock_alarms();
+ ap_register_cleanup(p, (void *) d, dir_cleanup, dir_cleanup);
+ ap_unblock_alarms();
return d;
}
-API_EXPORT(void) apr_pclosedir(apr_pool_t *p, DIR * d)
+API_EXPORT(void) ap_pclosedir(ap_pool_t *p, DIR * d)
{
- apr_block_alarms();
- apr_kill_cleanup(p, (void *) d, dir_cleanup);
+ ap_block_alarms();
+ ap_kill_cleanup(p, (void *) d, dir_cleanup);
closedir(d);
- apr_unblock_alarms();
+ ap_unblock_alarms();
}
/*****************************************************************
@@ -2017,47 +2017,47 @@
closesocket((int) (long) fdv);
}
-API_EXPORT(void) apr_note_cleanups_for_socket(apr_pool_t *p, int fd)
+API_EXPORT(void) ap_note_cleanups_for_socket(ap_pool_t *p, int fd)
{
- apr_register_cleanup(p, (void *) (long) fd, socket_cleanup,
+ ap_register_cleanup(p, (void *) (long) fd, socket_cleanup,
socket_cleanup);
}
-API_EXPORT(void) apr_kill_cleanups_for_socket(apr_pool_t *p, int sock)
+API_EXPORT(void) ap_kill_cleanups_for_socket(ap_pool_t *p, int sock)
{
- apr_kill_cleanup(p, (void *) (long) sock, socket_cleanup);
+ ap_kill_cleanup(p, (void *) (long) sock, socket_cleanup);
}
-API_EXPORT(int) apr_psocket(apr_pool_t *p, int domain, int type, int protocol)
+API_EXPORT(int) ap_psocket(ap_pool_t *p, int domain, int type, int protocol)
{
int fd;
- apr_block_alarms();
+ ap_block_alarms();
fd = socket(domain, type, protocol);
if (fd == -1) {
int save_errno = errno;
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = save_errno;
return -1;
}
- apr_note_cleanups_for_socket(p, fd);
- apr_unblock_alarms();
+ ap_note_cleanups_for_socket(p, fd);
+ ap_unblock_alarms();
return fd;
}
-API_EXPORT(int) apr_pclosesocket(apr_pool_t *a, int sock)
+API_EXPORT(int) ap_pclosesocket(ap_pool_t *a, int sock)
{
int res;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
res = closesocket(sock);
#ifdef WIN32
errno = WSAGetLastError();
#endif
save_errno = errno;
- apr_kill_cleanup(a, (void *) (long) sock, socket_cleanup);
- apr_unblock_alarms();
+ ap_kill_cleanup(a, (void *) (long) sock, socket_cleanup);
+ ap_unblock_alarms();
errno = save_errno;
return res;
}
@@ -2076,27 +2076,27 @@
regfree((regex_t *) preg);
}
-API_EXPORT(regex_t *) apr_pregcomp(apr_pool_t *p, const char *pattern,
+API_EXPORT(regex_t *) ap_pregcomp(ap_pool_t *p, const char *pattern,
int cflags)
{
- regex_t *preg = apr_palloc(p, sizeof(regex_t));
+ regex_t *preg = ap_palloc(p, sizeof(regex_t));
if (regcomp(preg, pattern, cflags)) {
return NULL;
}
- apr_register_cleanup(p, (void *) preg, regex_cleanup, regex_cleanup);
+ ap_register_cleanup(p, (void *) preg, regex_cleanup, regex_cleanup);
return preg;
}
-API_EXPORT(void) apr_pregfree(apr_pool_t *p, regex_t * reg)
+API_EXPORT(void) ap_pregfree(ap_pool_t *p, regex_t * reg)
{
- apr_block_alarms();
+ ap_block_alarms();
regfree(reg);
- apr_kill_cleanup(p, (void *) reg, regex_cleanup);
- apr_unblock_alarms();
+ ap_kill_cleanup(p, (void *) reg, regex_cleanup);
+ ap_unblock_alarms();
}
#endif /* if 0 not really needed anymore. APR takes care of this. */
/*****************************************************************
@@ -2110,11 +2110,11 @@
* generic interface, but for now, it's a special case
*/
-API_EXPORT(void) apr_note_subprocess(apr_pool_t *a, pid_t pid,
+API_EXPORT(void) ap_note_subprocess(ap_pool_t *a, pid_t pid,
enum kill_conditions how)
{
struct process_chain *new =
- (struct process_chain *) apr_palloc(a, sizeof(struct process_chain));
+ (struct process_chain *) ap_palloc(a, sizeof(struct process_chain));
new->pid = pid;
new->kill_how = how;
@@ -2128,7 +2128,7 @@
#define os_pipe(fds) pipe(fds)
#endif /* WIN32 */
-/* for apr_fdopen, to get binary mode */
+/* for ap_fdopen, to get binary mode */
#if defined (OS2) || defined (WIN32)
#define BINMODE "b"
#else
@@ -2136,8 +2136,8 @@
#endif
#if 0
-static pid_t spawn_child_core(apr_pool_t *p,
- int (*func) (void *, apr_child_info_t *),
+static pid_t spawn_child_core(ap_pool_t *p,
+ int (*func) (void *, ap_child_info_t *),
void *data,enum kill_conditions kill_how,
int *pipe_in, int *pipe_out, int *pipe_err)
{
@@ -2181,9 +2181,9 @@
HANDLE thread_handle;
int hStdIn, hStdOut, hStdErr;
int old_priority;
- apr_child_info_t info;
+ ap_child_info_t info;
- (void) apr_acquire_mutex(spawn_mutex);
+ (void) ap_acquire_mutex(spawn_mutex);
thread_handle = GetCurrentThread(); /* doesn't need to be closed */
old_priority = GetThreadPriority(thread_handle);
SetThreadPriority(thread_handle, THREAD_PRIORITY_HIGHEST);
@@ -2191,7 +2191,7 @@
if (pipe_in) {
hStdIn = dup(fileno(stdin));
if (dup2(in_fds[0], fileno(stdin))) {
- apr_log_error(APLOG_MARK, APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
"dup2(stdin) failed");
}
close(in_fds[0]);
@@ -2200,7 +2200,7 @@
hStdOut = dup(fileno(stdout));
close(fileno(stdout));
if (dup2(out_fds[1], fileno(stdout))) {
- apr_log_error(APLOG_MARK, APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
"dup2(stdout) failed");
}
close(out_fds[1]);
@@ -2208,7 +2208,7 @@
if (pipe_err) {
hStdErr = dup(fileno(stderr));
if (dup2(err_fds[1], fileno(stderr))) {
- apr_log_error(APLOG_MARK, APLOG_ERR, NULL,
+ ap_log_error(APLOG_MARK, APLOG_ERR, NULL,
"dup2(stdin) failed");
}
close(err_fds[1]);
@@ -2245,7 +2245,7 @@
}
if (pid) {
- apr_note_subprocess(p, pid, kill_how);
+ ap_note_subprocess(p, pid, kill_how);
if (pipe_in) {
*pipe_in = in_fds[1];
}
@@ -2257,7 +2257,7 @@
}
}
SetThreadPriority(thread_handle, old_priority);
- (void) apr_release_mutex(spawn_mutex);
+ (void) ap_release_mutex(spawn_mutex);
/*
* go on to the end of the function, where you can
* unblock alarms and return the pid
@@ -2289,7 +2289,7 @@
pid = func(data, NULL);
if (pid) {
- apr_note_subprocess(p, pid, kill_how);
+ ap_note_subprocess(p, pid, kill_how);
}
if (pipe_out) {
@@ -2314,7 +2314,7 @@
}
}
#elif defined(TPF)
- return (pid = apr_tpf_spawn_child(p, func, data, kill_how,
+ return (pid = ap_tpf_spawn_child(p, func, data, kill_how,
pipe_in, pipe_out, pipe_err, out_fds,
in_fds, err_fds));
#else
@@ -2371,7 +2371,7 @@
/* Parent process */
- apr_note_subprocess(p, pid, kill_how);
+ ap_note_subprocess(p, pid, kill_how);
if (pipe_out) {
close(out_fds[1]);
@@ -2393,8 +2393,8 @@
}
-API_EXPORT(int) apr_spawn_child(apr_pool_t *p,
- int (*func) (void *v, apr_child_info_t *c),
+API_EXPORT(int) ap_spawn_child(ap_pool_t *p,
+ int (*func) (void *v, ap_child_info_t *c),
void *data, enum kill_conditions kill_how,
FILE **pipe_in, FILE **pipe_out,
FILE **pipe_err)
@@ -2403,7 +2403,7 @@
pid_t pid;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
pid = spawn_child_core(p, func, data, kill_how,
pipe_in ? &fd_in : NULL,
@@ -2412,15 +2412,15 @@
if (pid == 0) {
save_errno = errno;
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = save_errno;
return 0;
}
if (pipe_out) {
- *pipe_out = apr_fdopen(fd_out, "r" BINMODE);
+ *pipe_out = ap_fdopen(fd_out, "r" BINMODE);
if (*pipe_out) {
- apr_note_cleanups_for_file(p, *pipe_out);
+ ap_note_cleanups_for_file(p, *pipe_out);
}
else {
close(fd_out);
@@ -2428,9 +2428,9 @@
}
if (pipe_in) {
- *pipe_in = apr_fdopen(fd_in, "w" BINMODE);
+ *pipe_in = ap_fdopen(fd_in, "w" BINMODE);
if (*pipe_in) {
- apr_note_cleanups_for_file(p, *pipe_in);
+ ap_note_cleanups_for_file(p, *pipe_in);
}
else {
close(fd_in);
@@ -2438,21 +2438,21 @@
}
if (pipe_err) {
- *pipe_err = apr_fdopen(fd_err, "r" BINMODE);
+ *pipe_err = ap_fdopen(fd_err, "r" BINMODE);
if (*pipe_err) {
- apr_note_cleanups_for_file(p, *pipe_err);
+ ap_note_cleanups_for_file(p, *pipe_err);
}
else {
close(fd_err);
}
}
- apr_unblock_alarms();
+ ap_unblock_alarms();
return pid;
}
-API_EXPORT(int) apr_bspawn_child(apr_pool_t *p,
- int (*func) (void *v, apr_child_info_t *c),
+API_EXPORT(int) ap_bspawn_child(ap_pool_t *p,
+ int (*func) (void *v, ap_child_info_t *c),
void *data, enum kill_conditions kill_how,
BUFF **pipe_in, BUFF **pipe_out,
BUFF **pipe_err)
@@ -2470,9 +2470,9 @@
HANDLE hPipeErrorReadDup = NULL;
HANDLE hCurrentProcess;
pid_t pid = 0;
- apr_child_info_t info;
+ ap_child_info_t info;
- apr_block_alarms();
+ ap_block_alarms();
/*
* First thing to do is to create the pipes that we will use
@@ -2588,13 +2588,13 @@
* so we read from this pipe.
*/
/* Create a read buffer */
- *pipe_out = apr_bcreate(p, B_RD);
+ *pipe_out = ap_bcreate(p, B_RD);
/* Setup the cleanup routine for the handle */
- apr_note_cleanups_for_h(p, hPipeOutputRead);
+ ap_note_cleanups_for_h(p, hPipeOutputRead);
/* Associate the handle with the new buffer */
- apr_bpushh(*pipe_out, hPipeOutputRead);
+ ap_bpushh(*pipe_out, hPipeOutputRead);
}
if (pipe_in) {
@@ -2603,13 +2603,13 @@
* write to this pipe.
*/
/* Create a write buffer */
- *pipe_in = apr_bcreate(p, B_WR);
+ *pipe_in = ap_bcreate(p, B_WR);
/* Setup the cleanup routine for the handle */
- apr_note_cleanups_for_h(p, hPipeInputWrite);
+ ap_note_cleanups_for_h(p, hPipeInputWrite);
/* Associate the handle with the new buffer */
- apr_bpushh(*pipe_in, hPipeInputWrite);
+ ap_bpushh(*pipe_in, hPipeInputWrite);
}
@@ -2619,13 +2619,13 @@
* we read from this pipe.
*/
/* Create a read buffer */
- *pipe_err = apr_bcreate(p, B_RD);
+ *pipe_err = ap_bcreate(p, B_RD);
/* Setup the cleanup routine for the handle */
- apr_note_cleanups_for_h(p, hPipeErrorRead);
+ ap_note_cleanups_for_h(p, hPipeErrorRead);
/* Associate the handle with the new buffer */
- apr_bpushh(*pipe_err, hPipeErrorRead);
+ ap_bpushh(*pipe_err, hPipeErrorRead);
}
}
@@ -2644,7 +2644,7 @@
pid_t pid;
int save_errno;
- apr_block_alarms();
+ ap_block_alarms();
pid = spawn_child_core(p, func, data, kill_how,
pipe_in ? &fd_in : NULL,
@@ -2653,31 +2653,31 @@
if (pid == 0) {
save_errno = errno;
- apr_unblock_alarms();
+ ap_unblock_alarms();
errno = save_errno;
return 0;
}
if (pipe_out) {
- *pipe_out = apr_bcreate(p, B_RD);
- apr_note_cleanups_for_fd(p, fd_out);
- apr_bpushfd(*pipe_out, fd_out, fd_out);
+ *pipe_out = ap_bcreate(p, B_RD);
+ ap_note_cleanups_for_fd(p, fd_out);
+ ap_bpushfd(*pipe_out, fd_out, fd_out);
}
if (pipe_in) {
- *pipe_in = apr_bcreate(p, B_WR);
- apr_note_cleanups_for_fd(p, fd_in);
- apr_bpushfd(*pipe_in, fd_in, fd_in);
+ *pipe_in = ap_bcreate(p, B_WR);
+ ap_note_cleanups_for_fd(p, fd_in);
+ ap_bpushfd(*pipe_in, fd_in, fd_in);
}
if (pipe_err) {
- *pipe_err = apr_bcreate(p, B_RD);
- apr_note_cleanups_for_fd(p, fd_err);
- apr_bpushfd(*pipe_err, fd_err, fd_err);
+ *pipe_err = ap_bcreate(p, B_RD);
+ ap_note_cleanups_for_fd(p, fd_err);
+ ap_bpushfd(*pipe_err, fd_err, fd_err);
}
#endif
- apr_unblock_alarms();
+ ap_unblock_alarms();
return pid;
}
#endif
1.2 +27 -27 apache-apr/apr/lib/apr_snprintf.c
Index: apr_snprintf.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/lib/apr_snprintf.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apr_snprintf.c 1999/03/24 18:39:12 1.1
+++ apr_snprintf.c 1999/05/10 17:46:22 1.2
@@ -98,7 +98,7 @@
*/
/*
- * apr_ecvt converts to decimal
+ * ap_ecvt converts to decimal
* the number of digits is specified by ndigit
* decpt is set to the position of the decimal point
* sign is set to 0 for positive, 1 for negative
@@ -107,7 +107,7 @@
#define NDIG 80
/* buf must have at least NDIG bytes */
-static char *apr_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
+static char *ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf)
{
register int r2;
double fi, fj;
@@ -180,29 +180,29 @@
return (buf);
}
-static char *apr_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
+static char *ap_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
{
- return (apr_cvt(arg, ndigits, decpt, sign, 1, buf));
+ return (ap_cvt(arg, ndigits, decpt, sign, 1, buf));
}
-static char *apr_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
+static char *ap_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf)
{
- return (apr_cvt(arg, ndigits, decpt, sign, 0, buf));
+ return (ap_cvt(arg, ndigits, decpt, sign, 0, buf));
}
/*
- * apr_gcvt - Floating output conversion to
+ * ap_gcvt - Floating output conversion to
* minimal length string
*/
-static char *apr_gcvt(double number, int ndigit, char *buf, boolean_e altform)
+static char *ap_gcvt(double number, int ndigit, char *buf, boolean_e altform)
{
int sign, decpt;
register char *p1, *p2;
register int i;
char buf1[NDIG];
- p1 = apr_ecvt(number, ndigit, &decpt, &sign, buf1);
+ p1 = ap_ecvt(number, ndigit, &decpt, &sign, buf1);
p2 = buf;
if (sign)
*p2++ = '-';
@@ -281,7 +281,7 @@
#define STR_TO_DEC( str, num ) \
num = NUM( *str++ ) ; \
- while ( apr_isdigit( *str ) ) \
+ while ( ap_isdigit( *str ) ) \
{ \
num *= 10 ; \
num += NUM( *str++ ) ; \
@@ -434,14 +434,14 @@
char buf1[NDIG];
if (format == 'f')
- p = apr_fcvt(num, precision, &decimal_point, is_negative, buf1);
+ p = ap_fcvt(num, precision, &decimal_point, is_negative, buf1);
else /* either e or E format */
- p = apr_ecvt(num, precision + 1, &decimal_point, is_negative, buf1);
+ p = ap_ecvt(num, precision + 1, &decimal_point, is_negative, buf1);
/*
* Check for Infinity and NaN
*/
- if (apr_isalpha(*p)) {
+ if (ap_isalpha(*p)) {
*len = strlen(strcpy(buf, p));
*is_negative = FALSE;
return (buf);
@@ -542,8 +542,8 @@
/*
* Do format conversion placing the output in buffer
*/
-API_EXPORT(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *),
- apr_vformatter_buff_t *vbuff, const char *fmt, va_list ap)
+API_EXPORT(int) ap_vformatter(int (*flush_func)(ap_vformatter_buff_t *),
+ ap_vformatter_buff_t *vbuff, const char *fmt, va_list ap)
{
register char *sp;
register char *bep;
@@ -601,7 +601,7 @@
/*
* Try to avoid checking for flags, width or precision
*/
- if (!apr_islower(*fmt)) {
+ if (!ap_islower(*fmt)) {
/*
* Recognize flags: -, #, BLANK, +
*/
@@ -623,7 +623,7 @@
/*
* Check if a width was specified
*/
- if (apr_isdigit(*fmt)) {
+ if (ap_isdigit(*fmt)) {
STR_TO_DEC(fmt, min_width);
adjust_width = YES;
}
@@ -649,7 +649,7 @@
if (*fmt == '.') {
adjust_precision = YES;
fmt++;
- if (apr_isdigit(*fmt)) {
+ if (ap_isdigit(*fmt)) {
STR_TO_DEC(fmt, precision);
}
else if (*fmt == '*') {
@@ -796,7 +796,7 @@
/*
* * We use &num_buf[ 1 ], so that we have room for the sign
*/
- s = apr_gcvt(va_arg(ap, double), precision, &num_buf[1],
+ s = ap_gcvt(va_arg(ap, double), precision, &num_buf[1],
alternate_form);
if (*s == '-')
prefix_char = *s++;
@@ -971,20 +971,20 @@
}
-static int snprintf_flush(apr_vformatter_buff_t *vbuff)
+static int snprintf_flush(ap_vformatter_buff_t *vbuff)
{
/* if the buffer fills we have to abort immediately, there is no way
- * to "flush" an apr_snprintf... there's nowhere to flush it to.
+ * to "flush" an ap_snprintf... there's nowhere to flush it to.
*/
return -1;
}
-API_EXPORT(int) apr_snprintf(char *buf, size_t len, const char *format,...)
+API_EXPORT(int) ap_snprintf(char *buf, size_t len, const char *format,...)
{
int cc;
va_list ap;
- apr_vformatter_buff_t vbuff;
+ ap_vformatter_buff_t vbuff;
if (len == 0)
return 0;
@@ -993,18 +993,18 @@
vbuff.curpos = buf;
vbuff.endpos = buf + len - 1;
va_start(ap, format);
- cc = apr_vformatter(snprintf_flush, &vbuff, format, ap);
+ cc = ap_vformatter(snprintf_flush, &vbuff, format, ap);
va_end(ap);
*vbuff.curpos = '\0';
return (cc == -1) ? len : cc;
}
-API_EXPORT(int) apr_vsnprintf(char *buf, size_t len, const char *format,
+API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format,
va_list ap)
{
int cc;
- apr_vformatter_buff_t vbuff;
+ ap_vformatter_buff_t vbuff;
if (len == 0)
return 0;
@@ -1012,7 +1012,7 @@
/* save one byte for nul terminator */
vbuff.curpos = buf;
vbuff.endpos = buf + len - 1;
- cc = apr_vformatter(snprintf_flush, &vbuff, format, ap);
+ cc = ap_vformatter(snprintf_flush, &vbuff, format, ap);
*vbuff.curpos = '\0';
return (cc == -1) ? len : cc;
}