#define __has_attribute(x) 0
#endif
#if (defined(__GNUC__) && __GNUC__ >= 4) || __has_attribute(sentinel)
-#define ap_func_attr_sentinel __attribute__((sentinel))
+#define AP_FN_ATTR_SENTINEL __attribute__((sentinel))
#else
-#define ap_func_attr_sentinel
+#define AP_FN_ATTR_SENTINEL
#endif
#if ( defined(__GNUC__) && \
(__GNUC__ >= 4 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))) \
|| __has_attribute(warn_unused_result)
-#define ap_func_attr_warn_unused_result __attribute__((warn_unused_result))
+#define AP_FN_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
#else
-#define ap_func_attr_warn_unused_result
+#define AP_FN_ATTR_WARN_UNUSED_RESULT
+#endif
+
+#if ( defined(__GNUC__) && \
+ (__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)) \
+ || __has_attribute(alloc_size)
+#define AP_FN_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
+#define AP_FN_ATTR_ALLOC_SIZE2(x,y) __attribute__((alloc_size(x,y)))
+#else
+#define AP_FN_ATTR_ALLOC_SIZE(x)
+#define AP_FN_ATTR_ALLOC_SIZE2(x,y)
#endif
#endif /* AP_CONFIG_H */
* @return The number of bytes sent
*/
AP_DECLARE_NONSTD(int) ap_rvputs(request_rec *r,...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Output data to the client in a printf format
* @return None.
*/
AP_DECLARE(void) ap_allow_methods(request_rec *r, int reset, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Add one or more methods to the list permitted to access the resource.
* @return pointer to the allocated memory
* @note ap_malloc may be implemented as a macro
*/
-AP_DECLARE(void *) ap_malloc(size_t size) __attribute__((malloc));
+AP_DECLARE(void *) ap_malloc(size_t size)
+ __attribute__((malloc))
+ AP_FN_ATTR_ALLOC_SIZE(1);
/**
* Wrapper for calloc() that calls ap_abort_on_oom() if out of memory
* @return pointer to the allocated memory
* @note ap_calloc may be implemented as a macro
*/
-AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size) __attribute__((malloc));
+AP_DECLARE(void *) ap_calloc(size_t nelem, size_t size)
+ __attribute__((malloc))
+ AP_FN_ATTR_ALLOC_SIZE2(1,2);
/**
* Wrapper for realloc() that calls ap_abort_on_oom() if out of memory
* @note ap_realloc may be implemented as a macro
*/
AP_DECLARE(void *) ap_realloc(void *ptr, size_t size)
- ap_func_attr_warn_unused_result;
+ AP_FN_ATTR_WARN_UNUSED_RESULT
+ AP_FN_ATTR_ALLOC_SIZE(2);
#define AP_NORESTART APR_OS_START_USEERR + 1
AP_DECLARE(apr_status_t) ap_cookie_write(request_rec * r, const char *name,
const char *val, const char *attrs,
long maxage, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Write an RFC2965 compliant cookie.
AP_DECLARE(apr_status_t) ap_cookie_write2(request_rec * r, const char *name2,
const char *val, const char *attrs2,
long maxage, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Remove an RFC2109 compliant cookie.
*/
AP_DECLARE(apr_status_t) ap_cookie_remove(request_rec * r, const char *name,
const char *attrs, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Remove an RFC2965 compliant cookie.
*/
AP_DECLARE(apr_status_t) ap_cookie_remove2(request_rec * r, const char *name2,
const char *attrs2, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Read a cookie called name, placing its value in val.
AP_DECLARE_NONSTD(apr_status_t) ap_fputstrs(ap_filter_t *f,
apr_bucket_brigade *bb,
...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Output data to the filter in printf format
char *buffer,
const char **termch,
int *termarg, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**
* Read headers strings from a script, ensuring that the output is valid. If
int module_index,
const char **termch,
int *termarg, ...)
- ap_func_attr_sentinel;
+ AP_FN_ATTR_SENTINEL;
/**