apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1103310 - in /apr/apr/trunk/include: apr_allocator.h apr_base64.h apr_buckets.h apr_pools.h
Date Sun, 15 May 2011 10:26:47 GMT
Author: sf
Date: Sun May 15 10:26:47 2011
New Revision: 1103310

URL: http://svn.apache.org/viewvc?rev=1103310&view=rev
Log:
Add some nonnull and pure attributes 

Modified:
    apr/apr/trunk/include/apr_allocator.h
    apr/apr/trunk/include/apr_base64.h
    apr/apr/trunk/include/apr_buckets.h
    apr/apr/trunk/include/apr_pools.h

Modified: apr/apr/trunk/include/apr_allocator.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_allocator.h?rev=1103310&r1=1103309&r2=1103310&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_allocator.h (original)
+++ apr/apr/trunk/include/apr_allocator.h Sun May 15 10:26:47 2011
@@ -71,7 +71,8 @@ struct apr_memnode_t {
  * @param allocator The allocator we have just created.
  *
  */
-APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);
+APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Destroy an allocator
@@ -79,7 +80,8 @@ APR_DECLARE(apr_status_t) apr_allocator_
  * @remark Any memnodes not given back to the allocator prior to destroying
  *         will _not_ be free()d.
  */
-APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator);
+APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator)
+                  __attribute__((nonnull(1)));
 
 /**
  * Allocate a block of mem from the allocator
@@ -88,7 +90,8 @@ APR_DECLARE(void) apr_allocator_destroy(
  *        memnode structure)
  */
 APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
-                                                 apr_size_t size);
+                                                 apr_size_t size)
+                             __attribute__((nonnull(1)));
 
 /**
  * Free a list of blocks of mem, giving them back to the allocator.
@@ -98,7 +101,8 @@ APR_DECLARE(apr_memnode_t *) apr_allocat
  * @param memnode The memory node to return
  */
 APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
-                                     apr_memnode_t *memnode);
+                                     apr_memnode_t *memnode)
+                  __attribute__((nonnull(1,2)));
 
 #include "apr_pools.h"
 
@@ -114,13 +118,15 @@ APR_DECLARE(void) apr_allocator_free(apr
  * the allocator will never be destroyed.
  */
 APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator,
-                                          apr_pool_t *pool);
+                                          apr_pool_t *pool)
+                  __attribute__((nonnull(1)));
 
 /**
  * Get the current owner of the allocator
  * @param allocator The allocator to get the owner from
  */
-APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);
+APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Set the current threshold at which the allocator should start
@@ -129,7 +135,8 @@ APR_DECLARE(apr_pool_t *) apr_allocator_
  * @param size The threshold.  0 == unlimited.
  */
 APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
-                                             apr_size_t size);
+                                             apr_size_t size)
+                  __attribute__((nonnull(1)));
 
 #include "apr_thread_mutex.h"
 
@@ -140,14 +147,16 @@ APR_DECLARE(void) apr_allocator_max_free
  * @param mutex The mutex
  */
 APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
-                                          apr_thread_mutex_t *mutex);
+                                          apr_thread_mutex_t *mutex)
+                  __attribute__((nonnull(1)));
 
 /**
  * Get the mutex currently set for the allocator
  * @param allocator The allocator
  */
 APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
-                                      apr_allocator_t *allocator);
+                                          apr_allocator_t *allocator)
+                                  __attribute__((nonnull(1)));
 
 #endif /* APR_HAS_THREADS */
 

Modified: apr/apr/trunk/include/apr_base64.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_base64.h?rev=1103310&r1=1103309&r2=1103310&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_base64.h (original)
+++ apr/apr/trunk/include/apr_base64.h Sun May 15 10:26:47 2011
@@ -57,7 +57,7 @@ extern "C" {
  * @return the length of the string after it is encrypted, including the
  * trailing \0
  */ 
-APR_DECLARE(int) apr_base64_encode_len(int len);
+APR_DECLARE(int) apr_base64_encode_len(int len) __attribute__((pure));
 
 /**
  * Encode a text string using base64encoding. On EBCDIC machines, the input
@@ -69,7 +69,8 @@ APR_DECLARE(int) apr_base64_encode_len(i
  * @return the length of the encoded string, including the trailing \0
  */ 
 APR_DECLARE(int) apr_base64_encode(char * coded_dst, const char *plain_src, 
-                                 int len_plain_src);
+                                   int len_plain_src)
+                 __attribute__((nonnull(1,2)));
 
 /**
  * Encode an text string using base64encoding. This is the same as
@@ -81,9 +82,10 @@ APR_DECLARE(int) apr_base64_encode(char 
  * @param len_plain_src The length of the plain text string
  * @return the length of the encoded string, including the trailing \0
  */ 
-APR_DECLARE(int) apr_base64_encode_binary(char * coded_dst, 
-                                        const unsigned char *plain_src,
-                                        int len_plain_src);
+APR_DECLARE(int) apr_base64_encode_binary(char * coded_dst,
+                                          const unsigned char *plain_src,
+                                          int len_plain_src)
+                 __attribute__((nonnull(1,2)));
 
 /**
  * Determine the maximum buffer length required to decode the plain text
@@ -91,7 +93,8 @@ APR_DECLARE(int) apr_base64_encode_binar
  * @param coded_src The encoded string
  * @return the maximum required buffer length for the plain text string
  */ 
-APR_DECLARE(int) apr_base64_decode_len(const char * coded_src);
+APR_DECLARE(int) apr_base64_decode_len(const char * coded_src)
+                 __attribute__((nonnull(1))) __attribute__((pure));
 
 /**
  * Decode a string to plain text. On EBCDIC machines, the result is then
@@ -101,7 +104,8 @@ APR_DECLARE(int) apr_base64_decode_len(c
  * @param coded_src The encoded string 
  * @return the length of the plain text string (excluding the trailing \0)
  */ 
-APR_DECLARE(int) apr_base64_decode(char * plain_dst, const char *coded_src);
+APR_DECLARE(int) apr_base64_decode(char * plain_dst, const char *coded_src)
+                 __attribute__((nonnull(1,2)));
 
 /**
  * Decode an string to plain text. This is the same as apr_base64_decode()
@@ -113,7 +117,8 @@ APR_DECLARE(int) apr_base64_decode(char 
  * @return the length of the plain text string
  */ 
 APR_DECLARE(int) apr_base64_decode_binary(unsigned char * plain_dst, 
-                                        const char *coded_src);
+                                          const char *coded_src)
+                 __attribute__((nonnull(1,2)));
 
 /** @} */
 #ifdef __cplusplus

Modified: apr/apr/trunk/include/apr_buckets.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_buckets.h?rev=1103310&r1=1103309&r2=1103310&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_buckets.h (original)
+++ apr/apr/trunk/include/apr_buckets.h Sun May 15 10:26:47 2011
@@ -659,14 +659,16 @@ union apr_bucket_structs {
  * @return The empty bucket brigade
  */
 APR_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p,
-                                                     apr_bucket_alloc_t *list);
+                                                     apr_bucket_alloc_t *list)
+                                  __attribute__((nonnull(1,2)));
 
 /**
  * Destroy an entire bucket brigade.  This includes destroying all of the
  * buckets within the bucket brigade's bucket list. 
  * @param b The bucket brigade to destroy
  */
-APR_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b);
+APR_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b)
+                          __attribute__((nonnull(1)));
 
 /**
  * Empty out an entire bucket brigade.  This includes destroying all of the
@@ -679,7 +681,8 @@ APR_DECLARE(apr_status_t) apr_brigade_de
  *         you wish to reuse many times by destroying all of the buckets in
  *         the brigade and putting new buckets into it later.
  */
-APR_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
+APR_DECLARE(apr_status_t) apr_brigade_cleanup(void *data)
+                          __attribute__((nonnull(1)));
 
 /**
  * Move the buckets from the tail end of the existing brigade @a b into
@@ -697,7 +700,8 @@ APR_DECLARE(apr_status_t) apr_brigade_cl
  */
 APR_DECLARE(apr_bucket_brigade *) apr_brigade_split_ex(apr_bucket_brigade *b,
                                                        apr_bucket *e,
-                                                       apr_bucket_brigade *a);
+                                                       apr_bucket_brigade *a)
+                                  __attribute__((nonnull(1,2)));
 
 /**
  * Create a new bucket brigade and move the buckets from the tail end
@@ -711,7 +715,8 @@ APR_DECLARE(apr_bucket_brigade *) apr_br
  * so memory consumption should be carefully considered.
  */
 APR_DECLARE(apr_bucket_brigade *) apr_brigade_split(apr_bucket_brigade *b,
-                                                    apr_bucket *e);
+                                                    apr_bucket *e)
+                                  __attribute__((nonnull(1,2)));
 
 /**
  * Partition a bucket brigade at a given offset (in bytes from the start of
@@ -727,7 +732,8 @@ APR_DECLARE(apr_bucket_brigade *) apr_br
  */
 APR_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b,
                                                 apr_off_t point,
-                                                apr_bucket **after_point);
+                                                apr_bucket **after_point)
+                          __attribute__((nonnull(1,3)));
 
 /**
  * Return the total length of the brigade.
@@ -739,7 +745,8 @@ APR_DECLARE(apr_status_t) apr_brigade_pa
  */
 APR_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
                                              int read_all,
-                                             apr_off_t *length);
+                                             apr_off_t *length)
+                          __attribute__((nonnull(1,3)));
 
 /**
  * Take a bucket brigade and store the data in a flat char*
@@ -750,7 +757,8 @@ APR_DECLARE(apr_status_t) apr_brigade_le
  */
 APR_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
                                               char *c,
-                                              apr_size_t *len);
+                                              apr_size_t *len)
+                          __attribute__((nonnull(1,2,3)));
 
 /**
  * Creates a pool-allocated string representing a flat bucket brigade
@@ -762,7 +770,8 @@ APR_DECLARE(apr_status_t) apr_brigade_fl
 APR_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb, 
                                                char **c,
                                                apr_size_t *len,
-                                               apr_pool_t *pool);
+                                               apr_pool_t *pool)
+                          __attribute__((nonnull(1,2,3,4)));
 
 /**
  * Split a brigade to represent one LF line.
@@ -775,7 +784,8 @@ APR_DECLARE(apr_status_t) apr_brigade_pf
 APR_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
                                                  apr_bucket_brigade *bbIn,
                                                  apr_read_type_e block,
-                                                 apr_off_t maxbytes);
+                                                 apr_off_t maxbytes)
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Create an iovec of the elements in a bucket_brigade... return number 
@@ -787,7 +797,8 @@ APR_DECLARE(apr_status_t) apr_brigade_sp
  *             number of iovec elements actually filled out.
  */
 APR_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b, 
-                                               struct iovec *vec, int *nvec);
+                                               struct iovec *vec, int *nvec)
+                          __attribute__((nonnull(1,2,3)));
 
 /**
  * This function writes a list of strings into a bucket brigade. 
@@ -800,7 +811,8 @@ APR_DECLARE(apr_status_t) apr_brigade_to
 APR_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b,
                                                apr_brigade_flush flush,
                                                void *ctx,
-                                               va_list va);
+                                               va_list va)
+                          __attribute__((nonnull(1)));
 
 /**
  * This function writes a string into a bucket brigade.
@@ -827,7 +839,8 @@ APR_DECLARE(apr_status_t) apr_brigade_vp
  */
 APR_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b,
                                             apr_brigade_flush flush, void *ctx,
-                                            const char *str, apr_size_t nbyte);
+                                            const char *str, apr_size_t nbyte)
+                          __attribute__((nonnull(1,4)));
 
 /**
  * This function writes multiple strings into a bucket brigade.
@@ -842,7 +855,8 @@ APR_DECLARE(apr_status_t) apr_brigade_wr
                                              apr_brigade_flush flush,
                                              void *ctx,
                                              const struct iovec *vec,
-                                             apr_size_t nvec);
+                                             apr_size_t nvec)
+                          __attribute__((nonnull(1,4)));
 
 /**
  * This function writes a string into a bucket brigade.
@@ -854,7 +868,8 @@ APR_DECLARE(apr_status_t) apr_brigade_wr
  */
 APR_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
                                            apr_brigade_flush flush, void *ctx,
-                                           const char *str);
+                                           const char *str)
+                          __attribute__((nonnull(1,4)));
 
 /**
  * This function writes a character into a bucket brigade.
@@ -866,7 +881,8 @@ APR_DECLARE(apr_status_t) apr_brigade_pu
  */
 APR_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b,
                                            apr_brigade_flush flush, void *ctx,
-                                           const char c);
+                                           const char c)
+                          __attribute__((nonnull(1)));
 
 /**
  * This function writes an unspecified number of strings into a bucket brigade.
@@ -882,6 +898,7 @@ APR_DECLARE_NONSTD(apr_status_t) apr_bri
 #if defined(__GNUC__) && __GNUC__ >= 4
     __attribute__((sentinel))
 #endif
+    __attribute__((nonnull(1)))
     ;
 
 /**
@@ -898,7 +915,8 @@ APR_DECLARE_NONSTD(apr_status_t) apr_bri
                                                     apr_brigade_flush flush,
                                                     void *ctx,
                                                     const char *fmt, ...)
-        __attribute__((format(printf,4,5)));
+                                 __attribute__((format(printf,4,5)))
+                                 __attribute__((nonnull(1)));
 
 /**
  * Evaluate a printf and put the resulting string at the end 
@@ -913,7 +931,8 @@ APR_DECLARE_NONSTD(apr_status_t) apr_bri
 APR_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b, 
                                               apr_brigade_flush flush,
                                               void *ctx,
-                                              const char *fmt, va_list va);
+                                              const char *fmt, va_list va)
+                          __attribute__((nonnull(1,4)));
 
 /**
  * Utility function to insert a file (or a segment of a file) onto the
@@ -931,7 +950,8 @@ APR_DECLARE(apr_bucket *) apr_brigade_in
                                                   apr_file_t *f,
                                                   apr_off_t start,
                                                   apr_off_t len,
-                                                  apr_pool_t *p);
+                                                  apr_pool_t *p)
+                          __attribute__((nonnull(1,2,5)));
 
 
 
@@ -959,26 +979,32 @@ APR_DECLARE_NONSTD(apr_bucket_alloc_t *)
  *          apr_allocator_t -- no automatic cleanups will happen.
  * @warning The allocator must never be used by more than one thread at a time.
  */
-APR_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(apr_allocator_t *allocator);
+APR_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(
+                                                 apr_allocator_t *allocator)
+                                         __attribute__((nonnull(1)));
 
 /**
  * Destroy a bucket allocator.
  * @param list The allocator to be destroyed
  */
-APR_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list);
+APR_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list)
+                         __attribute__((nonnull(1)));
 
 /**
  * Allocate memory for use by the buckets.
  * @param size The amount to allocate.
  * @param list The allocator from which to allocate the memory.
  */
-APR_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list);
+APR_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size,
+                                            apr_bucket_alloc_t *list)
+                           __attribute__((nonnull(2)));
 
 /**
  * Free memory previously allocated with apr_bucket_alloc().
  * @param block The block of memory to be freed.
  */
-APR_DECLARE_NONSTD(void) apr_bucket_free(void *block);
+APR_DECLARE_NONSTD(void) apr_bucket_free(void *block)
+                         __attribute__((nonnull(1)));
 
 
 /*  *****  Bucket Functions  *****  */
@@ -1339,7 +1365,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_eos
  * @param b The bucket to make into an EOS bucket
  * @return The new bucket, or NULL if allocation failed
  */
-APR_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b);
+APR_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b)
+                          __attribute__((nonnull(1)));
 
 /**
  * Create a flush  bucket.  This indicates that filters should flush their
@@ -1348,7 +1375,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_eos
  * @param list The freelist from which this bucket should be allocated
  * @return The new bucket, or NULL if allocation failed
  */
-APR_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list);
+APR_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1)));
 
 /**
  * Make the bucket passed in a FLUSH  bucket.  This indicates that filters 
@@ -1357,7 +1385,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_flu
  * @param b The bucket to make into a FLUSH bucket
  * @return The new bucket, or NULL if allocation failed
  */
-APR_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b);
+APR_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b)
+                          __attribute__((nonnull(1)));
 
 /**
  * Create a bucket referring to long-lived data.
@@ -1368,7 +1397,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_flu
  */
 APR_DECLARE(apr_bucket *) apr_bucket_immortal_create(const char *buf, 
                                                      apr_size_t nbyte,
-                                                     apr_bucket_alloc_t *list);
+                                                     apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,3)));
 
 /**
  * Make the bucket passed in a bucket refer to long-lived data
@@ -1379,7 +1409,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_imm
  */
 APR_DECLARE(apr_bucket *) apr_bucket_immortal_make(apr_bucket *b, 
                                                    const char *buf, 
-                                                   apr_size_t nbyte);
+                                                   apr_size_t nbyte)
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Create a bucket referring to data on the stack.
@@ -1390,7 +1421,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_imm
  */
 APR_DECLARE(apr_bucket *) apr_bucket_transient_create(const char *buf, 
                                                       apr_size_t nbyte,
-                                                      apr_bucket_alloc_t *list);
+                                                      apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,3)));
 
 /**
  * Make the bucket passed in a bucket refer to stack data
@@ -1401,7 +1433,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_tra
  */
 APR_DECLARE(apr_bucket *) apr_bucket_transient_make(apr_bucket *b, 
                                                     const char *buf,
-                                                    apr_size_t nbyte);
+                                                    apr_size_t nbyte)
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Create a bucket referring to memory on the heap. If the caller asks
@@ -1420,7 +1453,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_tra
 APR_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf, 
                                                  apr_size_t nbyte,
                                                  void (*free_func)(void *data),
-                                                 apr_bucket_alloc_t *list);
+                                                 apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,4)));
 /**
  * Make the bucket passed in a bucket refer to heap data
  * @param b The bucket to make into a HEAP bucket
@@ -1432,7 +1466,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_hea
  */
 APR_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char *buf,
                                                apr_size_t nbyte,
-                                               void (*free_func)(void *data));
+                                               void (*free_func)(void *data))
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Create a bucket referring to memory allocated from a pool.
@@ -1446,7 +1481,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_hea
 APR_DECLARE(apr_bucket *) apr_bucket_pool_create(const char *buf, 
                                                  apr_size_t length,
                                                  apr_pool_t *pool,
-                                                 apr_bucket_alloc_t *list);
+                                                 apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,3,4)));
 
 /**
  * Make the bucket passed in a bucket refer to pool data
@@ -1458,7 +1494,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_poo
  */
 APR_DECLARE(apr_bucket *) apr_bucket_pool_make(apr_bucket *b, const char *buf,
                                                apr_size_t length, 
-                                               apr_pool_t *pool);
+                                               apr_pool_t *pool)
+                          __attribute__((nonnull(1,2,4)));
 
 #if APR_HAS_MMAP
 /**
@@ -1473,7 +1510,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_poo
 APR_DECLARE(apr_bucket *) apr_bucket_mmap_create(apr_mmap_t *mm, 
                                                  apr_off_t start,
                                                  apr_size_t length,
-                                                 apr_bucket_alloc_t *list);
+                                                 apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,4)));
 
 /**
  * Make the bucket passed in a bucket refer to an MMAP'ed file
@@ -1486,7 +1524,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_mma
  */
 APR_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm,
                                                apr_off_t start, 
-                                               apr_size_t length);
+                                               apr_size_t length)
+                          __attribute__((nonnull(1,2)));
 #endif
 
 /**
@@ -1496,7 +1535,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_mma
  * @return The new bucket, or NULL if allocation failed
  */
 APR_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *thissock,
-                                                   apr_bucket_alloc_t *list);
+                                                   apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,2)));
 /**
  * Make the bucket passed in a bucket refer to a socket
  * @param b The bucket to make into a SOCKET bucket
@@ -1504,7 +1544,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_soc
  * @return The new bucket, or NULL if allocation failed
  */
 APR_DECLARE(apr_bucket *) apr_bucket_socket_make(apr_bucket *b, 
-                                                 apr_socket_t *thissock);
+                                                 apr_socket_t *thissock)
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Create a bucket referring to a pipe.
@@ -1513,7 +1554,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_soc
  * @return The new bucket, or NULL if allocation failed
  */
 APR_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *thispipe,
-                                                 apr_bucket_alloc_t *list);
+                                                 apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Make the bucket passed in a bucket refer to a pipe
@@ -1522,7 +1564,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_pip
  * @return The new bucket, or NULL if allocation failed
  */
 APR_DECLARE(apr_bucket *) apr_bucket_pipe_make(apr_bucket *b, 
-                                               apr_file_t *thispipe);
+                                               apr_file_t *thispipe)
+                          __attribute__((nonnull(1,2)));
 
 /**
  * Create a bucket referring to a file.
@@ -1544,7 +1587,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_fil
                                                  apr_off_t offset,
                                                  apr_size_t len, 
                                                  apr_pool_t *p,
-                                                 apr_bucket_alloc_t *list);
+                                                 apr_bucket_alloc_t *list)
+                          __attribute__((nonnull(1,4,5)));
 
 /**
  * Make the bucket passed in a bucket refer to a file
@@ -1558,7 +1602,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_fil
  */
 APR_DECLARE(apr_bucket *) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd,
                                                apr_off_t offset,
-                                               apr_size_t len, apr_pool_t *p);
+                                               apr_size_t len, apr_pool_t *p)
+                          __attribute__((nonnull(1,2,5)));
 
 /**
  * Enable or disable memory-mapping for a FILE bucket (default is enabled)
@@ -1567,7 +1612,8 @@ APR_DECLARE(apr_bucket *) apr_bucket_fil
  * @return APR_SUCCESS normally, or an error code if the operation fails
  */
 APR_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b,
-                                                      int enabled);
+                                                      int enabled)
+                          __attribute__((nonnull(1)));
 
 /** @} */
 #ifdef __cplusplus

Modified: apr/apr/trunk/include/apr_pools.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_pools.h?rev=1103310&r1=1103309&r2=1103310&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_pools.h (original)
+++ apr/apr/trunk/include/apr_pools.h Sun May 15 10:26:47 2011
@@ -196,7 +196,8 @@ APR_DECLARE(void) apr_pool_terminate(voi
 APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
                                              apr_pool_t *parent,
                                              apr_abortfunc_t abort_fn,
-                                             apr_allocator_t *allocator);
+                                             apr_allocator_t *allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Create a new unmanaged pool.
@@ -216,7 +217,8 @@ APR_DECLARE(apr_status_t) apr_pool_creat
  */
 APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
                                                    apr_abortfunc_t abort_fn,
-                                                   apr_allocator_t *allocator);
+                                                   apr_allocator_t *allocator)
+                          __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_pool_create_ex.
@@ -238,7 +240,8 @@ APR_DECLARE(apr_status_t) apr_pool_creat
                                                    apr_pool_t *parent,
                                                    apr_abortfunc_t abort_fn,
                                                    apr_allocator_t *allocator,
-                                                   const char *file_line);
+                                                   const char *file_line)
+                          __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_create_ex(newpool, parent, abort_fn, allocator)  \
@@ -264,7 +267,8 @@ APR_DECLARE(apr_status_t) apr_pool_creat
 APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
                                                    apr_abortfunc_t abort_fn,
                                                    apr_allocator_t *allocator,
-                                                   const char *file_line);
+                                                   const char *file_line)
+                          __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator)  \
@@ -320,7 +324,8 @@ APR_DECLARE(apr_status_t) apr_pool_creat
  * Find the pool's allocator
  * @param pool The pool to get the allocator from.
  */
-APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool);
+APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool)
+                               __attribute__((nonnull(1)));
 
 /**
  * Clear all memory in the pool and run all the cleanups. This also destroys all
@@ -330,7 +335,7 @@ APR_DECLARE(apr_allocator_t *) apr_pool_
  *         to re-use this memory for the next allocation.
  * @see apr_pool_destroy()
  */
-APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
+APR_DECLARE(void) apr_pool_clear(apr_pool_t *p) __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_pool_clear.
@@ -346,7 +351,8 @@ APR_DECLARE(void) apr_pool_clear(apr_poo
  *         and don't call apr_pool_destroy_clear directly.
  */
 APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
-                                       const char *file_line);
+                                       const char *file_line)
+                  __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_clear(p) \
@@ -359,7 +365,7 @@ APR_DECLARE(void) apr_pool_clear_debug(a
  * @param p The pool to destroy
  * @remark This will actually free the memory
  */
-APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
+APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p) __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_pool_destroy.
@@ -375,7 +381,8 @@ APR_DECLARE(void) apr_pool_destroy(apr_p
  *         and don't call apr_pool_destroy_debug directly.
  */
 APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
-                                         const char *file_line);
+                                         const char *file_line)
+                  __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pool_destroy(p) \
@@ -393,7 +400,8 @@ APR_DECLARE(void) apr_pool_destroy_debug
  * @param size The amount of memory to allocate
  * @return The allocated memory
  */
-APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size);
+APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size)
+                    __attribute__((nonnull(1)));
 
 /**
  * Debug version of apr_palloc
@@ -404,7 +412,8 @@ APR_DECLARE(void *) apr_palloc(apr_pool_
  * @return See: apr_palloc
  */
 APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size,
-                                     const char *file_line);
+                                     const char *file_line)
+                    __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_palloc(p, size) \
@@ -432,7 +441,8 @@ APR_DECLARE(void *) apr_pcalloc(apr_pool
  * @return See: apr_pcalloc
  */
 APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
-                                      const char *file_line);
+                                      const char *file_line)
+                    __attribute__((nonnull(1)));
 
 #if APR_POOL_DEBUG
 #define apr_pcalloc(p, size) \
@@ -453,21 +463,24 @@ APR_DECLARE(void *) apr_pcalloc_debug(ap
  *      deal with the error accordingly.
  */
 APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc,
-                                     apr_pool_t *pool);
+                                     apr_pool_t *pool)
+                  __attribute__((nonnull(2)));
 
 /**
  * Get the abort function associated with the specified pool.
  * @param pool The pool for retrieving the abort function.
  * @return The abort function for the given pool.
  */
-APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool);
+APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool)
+                             __attribute__((nonnull(1)));
 
 /**
  * Get the parent pool of the specified pool.
  * @param pool The pool for retrieving the parent pool.
  * @return The parent of the given pool.
  */
-APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool);
+APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool)
+                          __attribute__((nonnull(1)));
 
 /**
  * Determine if pool a is an ancestor of pool b.
@@ -487,7 +500,8 @@ APR_DECLARE(int) apr_pool_is_ancestor(ap
  * @param pool The pool to tag
  * @param tag  The tag
  */
-APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag);
+APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag)
+                  __attribute__((nonnull(1)));
 
 
 /*
@@ -513,11 +527,11 @@ APR_DECLARE(void) apr_pool_tag(apr_pool_
  *      key names is a typical way to help ensure this uniqueness.
  *
  */
-APR_DECLARE(apr_status_t) apr_pool_userdata_set(
-    const void *data,
-    const char *key,
-    apr_status_t (*cleanup)(void *),
-    apr_pool_t *pool);
+APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data,
+                                                const char *key,
+                                                apr_status_t (*cleanup)(void *),
+                                                apr_pool_t *pool)
+                          __attribute__((nonnull(2,4)));
 
 /**
  * Set the data associated with the current pool
@@ -539,10 +553,10 @@ APR_DECLARE(apr_status_t) apr_pool_userd
  *
  */
 APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
-    const void *data,
-    const char *key,
-    apr_status_t (*cleanup)(void *),
-    apr_pool_t *pool);
+                                const void *data, const char *key,
+                                apr_status_t (*cleanup)(void *),
+                                apr_pool_t *pool)
+                          __attribute__((nonnull(2,4)));
 
 /**
  * Return the data associated with the current pool.
@@ -551,7 +565,8 @@ APR_DECLARE(apr_status_t) apr_pool_userd
  * @param pool The current pool.
  */
 APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
-                                                apr_pool_t *pool);
+                                                apr_pool_t *pool)
+                          __attribute__((nonnull(1,2,3)));
 
 
 /**
@@ -578,10 +593,10 @@ APR_DECLARE(apr_status_t) apr_pool_userd
  *                      to exec - this function is called in the child, obviously!
  */
 APR_DECLARE(void) apr_pool_cleanup_register(
-    apr_pool_t *p,
-    const void *data,
-    apr_status_t (*plain_cleanup)(void *),
-    apr_status_t (*child_cleanup)(void *));
+                            apr_pool_t *p, const void *data,
+                            apr_status_t (*plain_cleanup)(void *),
+                            apr_status_t (*child_cleanup)(void *))
+                  __attribute__((nonnull(3,4)));
 
 /**
  * Register a function to be called when a pool is cleared or destroyed.
@@ -596,9 +611,9 @@ APR_DECLARE(void) apr_pool_cleanup_regis
  *                      or destroyed
  */
 APR_DECLARE(void) apr_pool_pre_cleanup_register(
-    apr_pool_t *p,
-    const void *data,
-    apr_status_t (*plain_cleanup)(void *));
+                            apr_pool_t *p, const void *data,
+                            apr_status_t (*plain_cleanup)(void *))
+                  __attribute__((nonnull(3)));
 
 /**
  * Remove a previously registered cleanup function.
@@ -613,7 +628,8 @@ APR_DECLARE(void) apr_pool_pre_cleanup_r
  *          function
  */
 APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
-                                        apr_status_t (*cleanup)(void *));
+                                        apr_status_t (*cleanup)(void *))
+                  __attribute__((nonnull(3)));
 
 /**
  * Replace the child cleanup function of a previously registered cleanup.
@@ -628,10 +644,10 @@ APR_DECLARE(void) apr_pool_cleanup_kill(
  * @param child_cleanup The function to register as the child cleanup
  */
 APR_DECLARE(void) apr_pool_child_cleanup_set(
-    apr_pool_t *p,
-    const void *data,
-    apr_status_t (*plain_cleanup)(void *),
-    apr_status_t (*child_cleanup)(void *));
+                        apr_pool_t *p, const void *data,
+                        apr_status_t (*plain_cleanup)(void *),
+                        apr_status_t (*child_cleanup)(void *))
+                  __attribute__((nonnull(3,4)));
 
 /**
  * Run the specified cleanup function immediately and unregister it.
@@ -644,10 +660,9 @@ APR_DECLARE(void) apr_pool_child_cleanup
  * @param data The data to remove from cleanup
  * @param cleanup The function to remove from cleanup
  */
-APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
-    apr_pool_t *p,
-    void *data,
-    apr_status_t (*cleanup)(void *));
+APR_DECLARE(apr_status_t) apr_pool_cleanup_run(apr_pool_t *p, void *data,
+                                               apr_status_t (*cleanup)(void *))
+                          __attribute__((nonnull(3)));
 
 /**
  * An empty cleanup function.
@@ -716,7 +731,8 @@ APR_DECLARE(void) apr_pool_cleanup_for_e
  * @param p The parent pool
  * @param sub The subpool
  */
-APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
+APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub)
+                  __attribute__((nonnull(2)));
 
 /**
  * Find a pool from something allocated in it.
@@ -731,7 +747,8 @@ APR_DECLARE(apr_pool_t *) apr_pool_find(
  * @param recurse Recurse/include the subpools' sizes
  * @return The number of bytes
  */
-APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse);
+APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse)
+                        __attribute__((nonnull(1)));
 
 /**
  * Lock a pool



Mime
View raw message