diff options
author | Graham Leggett <minfrin@apache.org> | 2018-08-19 11:39:35 +0000 |
---|---|---|
committer | Graham Leggett <minfrin@apache.org> | 2018-08-19 11:39:35 +0000 |
commit | 2d02c4dfffa668e7c785c201ceef4c8bf64983d3 (patch) | |
tree | 09435a71965e09eb9321bf4b67b3db9806569e62 /include/apu_errno.h | |
parent | 5a1b9a92dad639eea47c78e28bae25eafa014331 (diff) | |
download | apr-2d02c4dfffa668e7c785c201ceef4c8bf64983d3.tar.gz |
Add apr_errprintf() as a convenience function to create and
populate apu_err_t.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1838375 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include/apu_errno.h')
-rw-r--r-- | include/apu_errno.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/apu_errno.h b/include/apu_errno.h index 7d967add6..5c309b4f2 100644 --- a/include/apu_errno.h +++ b/include/apu_errno.h @@ -24,6 +24,7 @@ #include "apr.h" #include "apr_errno.h" +#include "apr_pools.h" #ifdef __cplusplus extern "C" { @@ -171,6 +172,27 @@ typedef struct apu_err_t { int rc; } apu_err_t; +/** + * Populate a apu_err_t structure with the given error, allocated + * from the given pool. + * + * If the result parameter points at a NULL pointer, a apu_err_t + * structure will be allocated, otherwise the apu_err_t structure + * will be reused. + * @param result If points to NULL, the apu_err_t structure is + * allocated and returned, otherwise the existing apu_err_t is used. + * @param p The pool to use. + * @param reason The reason string, may be NULL. + * @param rc The underlying result code. + * @param fmt The format of the string + * @param ... The arguments to use while printing the data + * @return APR_SUCCESS on success, APR_ENOMEM if out of memory. + */ +APR_DECLARE_NONSTD(apr_status_t) apr_errprintf(apu_err_t **result, + apr_pool_t *p, const char *reason, int rc, const char *fmt, ...) + __attribute__((format(printf,5,6))) + __attribute__((nonnull(1,2))); + /** @} */ #ifdef __cplusplus |