[asterisk-commits] rmudgett: trunk r398557 - in /trunk: ./ apps/ include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 6 14:26:49 CDT 2013


Author: rmudgett
Date: Fri Sep  6 14:26:48 2013
New Revision: 398557

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398557
Log:
astobj2: Add warn unused attribute to some functions.

* Fixed resulting warnings with improper use of ao2_global_obj_replace().

* Made a couple uses of ao2_global_obj_replace_unref(x, NULL) into the
equivalent and more appropriate ao2_global_obj_release() call.
........

Merged revisions 398533 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/apps/app_agent_pool.c
    trunk/include/asterisk/astobj2.h
    trunk/main/cdr.c
    trunk/main/cel.c
    trunk/main/features_config.c
    trunk/main/parking.c
    trunk/main/stasis_config.c
    trunk/main/udptl.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Fri Sep  6 14:26:48 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398198,398206,398215,398226,398237,398283,398286,398299,398303,398368,398381,398418,398458,398498,398511,398521
+/branches/12:1-398198,398206,398215,398226,398237,398283,398286,398299,398303,398368,398381,398418,398458,398498,398511,398521,398533

Modified: trunk/apps/app_agent_pool.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_agent_pool.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/apps/app_agent_pool.c (original)
+++ trunk/apps/app_agent_pool.c Fri Sep  6 14:26:48 2013
@@ -1353,7 +1353,7 @@
  */
 static void bridge_agent_hold_dissolving(struct ast_bridge *self)
 {
-	ao2_global_obj_replace_unref(agent_holding, NULL);
+	ao2_global_obj_release(agent_holding);
 	ast_bridge_base_v_table.dissolving(self);
 }
 

Modified: trunk/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/astobj2.h?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/include/asterisk/astobj2.h (original)
+++ trunk/include/asterisk/astobj2.h Fri Sep  6 14:26:48 2013
@@ -469,8 +469,8 @@
 #endif
 
 void *__ao2_alloc_debug(size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options, const char *tag,
-	const char *file, int line, const char *func, int ref_debug);
-void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options);
+	const char *file, int line, const char *func, int ref_debug) attribute_warn_unused_result;
+void *__ao2_alloc(size_t data_size, ao2_destructor_fn destructor_fn, unsigned int options) attribute_warn_unused_result;
 
 /*! @} */
 
@@ -699,7 +699,7 @@
 	__ao2_global_obj_replace(&holder, (obj), NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 #endif
 
-void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name);
+void *__ao2_global_obj_replace(struct ao2_global_obj *holder, void *obj, const char *tag, const char *file, int line, const char *func, const char *name) attribute_warn_unused_result;
 
 /*!
  * \brief Replace an ao2 object in the global holder, throwing away any old object.
@@ -757,7 +757,7 @@
 	__ao2_global_obj_ref(&holder, NULL, __FILE__, __LINE__, __PRETTY_FUNCTION__, #holder)
 #endif
 
-void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name);
+void *__ao2_global_obj_ref(struct ao2_global_obj *holder, const char *tag, const char *file, int line, const char *func, const char *name) attribute_warn_unused_result;
 
 
 /*!
@@ -1227,11 +1227,11 @@
 
 struct ao2_container *__ao2_container_alloc_hash(unsigned int ao2_options,
 	unsigned int container_options, unsigned int n_buckets, ao2_hash_fn *hash_fn,
-	ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn);
+	ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn) attribute_warn_unused_result;
 struct ao2_container *__ao2_container_alloc_hash_debug(unsigned int ao2_options,
 	unsigned int container_options, unsigned int n_buckets, ao2_hash_fn *hash_fn,
 	ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn,
-	const char *tag, const char *file, int line, const char *func, int ref_debug);
+	const char *tag, const char *file, int line, const char *func, int ref_debug) attribute_warn_unused_result;
 
 /*!
  * \brief Allocate and initialize a list container.
@@ -1272,10 +1272,10 @@
 #endif
 
 struct ao2_container *__ao2_container_alloc_list(unsigned int ao2_options,
-	unsigned int container_options, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn);
+	unsigned int container_options, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn) attribute_warn_unused_result;
 struct ao2_container *__ao2_container_alloc_list_debug(unsigned int ao2_options,
 	unsigned int container_options, ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn,
-	const char *tag, const char *file, int line, const char *func, int ref_debug);
+	const char *tag, const char *file, int line, const char *func, int ref_debug) attribute_warn_unused_result;
 
 /*!
  * \brief Allocate and initialize a red-black tree container.
@@ -1315,10 +1315,10 @@
 #endif
 
 struct ao2_container *__ao2_container_alloc_rbtree(unsigned int ao2_options, unsigned int container_options,
-	ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn);
+	ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn) attribute_warn_unused_result;
 struct ao2_container *__ao2_container_alloc_rbtree_debug(unsigned int ao2_options, unsigned int container_options,
 	ao2_sort_fn *sort_fn, ao2_callback_fn *cmp_fn,
-	const char *tag, const char *file, int line, const char *func, int ref_debug);
+	const char *tag, const char *file, int line, const char *func, int ref_debug) attribute_warn_unused_result;
 
 /*! \brief
  * Returns the number of elements in a container.
@@ -1358,8 +1358,8 @@
  * \retval Clone container on success.
  * \retval NULL on error.
  */
-struct ao2_container *__ao2_container_clone(struct ao2_container *orig, enum search_flags flags);
-struct ao2_container *__ao2_container_clone_debug(struct ao2_container *orig, enum search_flags flags, const char *tag, const char *file, int line, const char *func, int ref_debug);
+struct ao2_container *__ao2_container_clone(struct ao2_container *orig, enum search_flags flags) attribute_warn_unused_result;
+struct ao2_container *__ao2_container_clone_debug(struct ao2_container *orig, enum search_flags flags, const char *tag, const char *file, int line, const char *func, int ref_debug) attribute_warn_unused_result;
 #if defined(REF_DEBUG)
 
 #define ao2_t_container_clone(orig, flags, tag)	__ao2_container_clone_debug(orig, flags, tag, __FILE__, __LINE__, __PRETTY_FUNCTION__, 1)
@@ -1895,7 +1895,7 @@
  *
  * This function will take a reference on the container being iterated.
  */
-struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags);
+struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result;
 
 /*!
  * \brief Destroy a container iterator
@@ -1925,8 +1925,8 @@
 
 #endif
 
-void *__ao2_iterator_next_debug(struct ao2_iterator *iter, const char *tag, const char *file, int line, const char *func);
-void *__ao2_iterator_next(struct ao2_iterator *iter);
+void *__ao2_iterator_next_debug(struct ao2_iterator *iter, const char *tag, const char *file, int line, const char *func) attribute_warn_unused_result;
+void *__ao2_iterator_next(struct ao2_iterator *iter) attribute_warn_unused_result;
 
 /*!
  * \brief Restart an iteration.

Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Fri Sep  6 14:26:48 2013
@@ -3949,7 +3949,7 @@
 		 */
 		if (!reload && !(aco_set_defaults(&general_option, "general", mod_cfg->general))) {
 			ast_log(LOG_NOTICE, "Failed to process CDR configuration; using defaults\n");
-			ao2_global_obj_replace(module_configs, mod_cfg);
+			ao2_global_obj_replace_unref(module_configs, mod_cfg);
 			return 0;
 		}
 		return 1;

Modified: trunk/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cel.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/main/cel.c (original)
+++ trunk/main/cel.c Fri Sep  6 14:26:48 2013
@@ -1503,7 +1503,7 @@
 		 */
 		if (!aco_set_defaults(&general_option, "general", cel_cfg->general)) {
 			ast_log(LOG_NOTICE, "Failed to process CEL configuration; using defaults\n");
-			ao2_global_obj_replace(cel_configs, cel_cfg);
+			ao2_global_obj_replace_unref(cel_configs, cel_cfg);
 		}
 	}
 

Modified: trunk/main/features_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features_config.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/main/features_config.c (original)
+++ trunk/main/features_config.c Fri Sep  6 14:26:48 2013
@@ -1748,7 +1748,7 @@
 		}
 
 		ast_log(LOG_NOTICE, "Could not load features config; using defaults\n");
-		ao2_global_obj_replace(globals, features_cfg);
+		ao2_global_obj_replace_unref(globals, features_cfg);
 	}
 
 	return 0;

Modified: trunk/main/parking.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/parking.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/main/parking.c (original)
+++ trunk/main/parking.c Fri Sep  6 14:26:48 2013
@@ -216,7 +216,7 @@
 	}
 	*wrapper = *fn_table;
 
-	ao2_global_obj_replace(parking_provider, wrapper);
+	ao2_global_obj_replace_unref(parking_provider, wrapper);
 	return 0;
 }
 
@@ -234,7 +234,7 @@
 		return -1;
 	}
 
-	ao2_global_obj_replace_unref(parking_provider, NULL);
+	ao2_global_obj_release(parking_provider);
 	return 0;
 }
 

Modified: trunk/main/stasis_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_config.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/main/stasis_config.c (original)
+++ trunk/main/stasis_config.c Fri Sep  6 14:26:48 2013
@@ -157,7 +157,7 @@
 		if (conf && !reload
 			&& !aco_set_defaults(&threadpool_option, "threadpool", conf->threadpool)) {
 			ast_log(AST_LOG_NOTICE, "Failed to process Stasis configuration; using defaults\n");
-			ao2_global_obj_replace(confs, conf);
+			ao2_global_obj_replace_unref(confs, conf);
 			return 0;
 		}
 		return -1;

Modified: trunk/main/udptl.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/udptl.c?view=diff&rev=398557&r1=398556&r2=398557
==============================================================================
--- trunk/main/udptl.c (original)
+++ trunk/main/udptl.c Fri Sep  6 14:26:48 2013
@@ -1468,7 +1468,7 @@
 			}
 
 			ast_log(LOG_NOTICE, "Could not load udptl config; using defaults\n");
-			ao2_global_obj_replace(globals, udptl_cfg);
+			ao2_global_obj_replace_unref(globals, udptl_cfg);
 		}
 	}
 }




More information about the asterisk-commits mailing list