From 2b2d34b3c9ab2c8d08b9d448b81f37898cd6007b Mon Sep 17 00:00:00 2001
From: Russell Bryant <russell@russellbryant.com>
Date: Sat, 31 Dec 2011 15:45:57 +0000
Subject: [PATCH] Constify tag argument in REF_DEBUG related code.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@349409 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_sip.c           |  4 ++--
 channels/sip/include/dialog.h |  4 ++--
 include/asterisk/astobj2.h    | 26 +++++++++++++-------------
 main/astobj2.c                | 22 +++++++++++-----------
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 99fb9b0244..04280285c8 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2222,7 +2222,7 @@ static struct ast_tcptls_session_args sip_tls_desc = {
 	\return Always returns 0 */
 #define append_history(p, event, fmt , args... )	append_history_full(p, "%-15s " fmt, event, ## args)
 
-struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func)
 {
 	if (p)
 #ifdef REF_DEBUG
@@ -2235,7 +2235,7 @@ struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int l
 	return p;
 }
 
-struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func)
+struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func)
 {
 	if (p)
 #ifdef REF_DEBUG
diff --git a/channels/sip/include/dialog.h b/channels/sip/include/dialog.h
index d4024c0688..dc60f97532 100644
--- a/channels/sip/include/dialog.h
+++ b/channels/sip/include/dialog.h
@@ -31,8 +31,8 @@
  */
 #define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func);
-struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, char *file, int line, const char *func);
+struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func);
+struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, char *file, int line, const char *func);
 
 struct sip_pvt *sip_alloc(ast_string_field callid, struct ast_sockaddr *sin,
 				 int useglobal_nat, const int intended_method, struct sip_request *req);
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index d0e15d5ade..15655b1f14 100644
--- a/include/asterisk/astobj2.h
+++ b/include/asterisk/astobj2.h
@@ -207,7 +207,7 @@ were called to appear in /tmp/refs, you can do this sort of thing:
 #ifdef REF_DEBUG
 #define dialog_ref(arg1,arg2) dialog_ref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 #define dialog_unref(arg1,arg2) dialog_unref_debug((arg1),(arg2), __FILE__, __LINE__, __PRETTY_FUNCTION__)
-static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, const char *file, int line, const char *func)
+static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, const char *tag, const char *file, int line, const char *func)
 {
 	if (p)
 		ao2_ref_debug(p, 1, tag, file, line, func);
@@ -216,14 +216,14 @@ static struct sip_pvt *dialog_ref_debug(struct sip_pvt *p, char *tag, const char
 	return p;
 }
 
-static struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, char *tag, const char *file, int line, const char *func)
+static struct sip_pvt *dialog_unref_debug(struct sip_pvt *p, const char *tag, const char *file, int line, const char *func)
 {
 	if (p)
 		ao2_ref_debug(p, -1, tag, file, line, func);
 	return NULL;
 }
 #else
-static struct sip_pvt *dialog_ref(struct sip_pvt *p, char *tag)
+static struct sip_pvt *dialog_ref(struct sip_pvt *p, const char *tag)
 {
 	if (p)
 		ao2_ref(p, 1);
@@ -232,7 +232,7 @@ static struct sip_pvt *dialog_ref(struct sip_pvt *p, char *tag)
 	return p;
 }
 
-static struct sip_pvt *dialog_unref(struct sip_pvt *p, char *tag)
+static struct sip_pvt *dialog_unref(struct sip_pvt *p, const char *tag)
 {
 	if (p)
 		ao2_ref(p, -1);
@@ -420,7 +420,7 @@ typedef void (*ao2_destructor_fn)(void *);
 
 #endif
 
-void *__ao2_alloc_debug(const size_t data_size, ao2_destructor_fn destructor_fn, char *tag,
+void *__ao2_alloc_debug(const size_t data_size, ao2_destructor_fn destructor_fn, const char *tag,
 			const char *file, int line, const char *funcname, int ref_debug);
 void *__ao2_alloc(const size_t data_size, ao2_destructor_fn destructor_fn);
 
@@ -462,7 +462,7 @@ void *__ao2_alloc(const size_t data_size, ao2_destructor_fn destructor_fn);
 
 #endif
 
-int __ao2_ref_debug(void *o, int delta, char *tag, char *file, int line, const char *funcname);
+int __ao2_ref_debug(void *o, int delta, const char *tag, char *file, int line, const char *funcname);
 int __ao2_ref(void *o, int delta);
 
 /*! @} */
@@ -743,7 +743,7 @@ struct ao2_container *__ao2_container_alloc(const unsigned int n_buckets,
 					    ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn);
 struct ao2_container *__ao2_container_alloc_debug(const unsigned int n_buckets,
 						  ao2_hash_fn *hash_fn, ao2_callback_fn *cmp_fn,
-						  char *tag, char *file, int line, const char *funcname,
+						  const char *tag, char *file, int line, const char *funcname,
 						  int ref_debug);
 
 /*! \brief
@@ -794,7 +794,7 @@ int ao2_container_count(struct ao2_container *c);
 
 #endif
 
-void *__ao2_link_debug(struct ao2_container *c, void *new_obj, int flags, char *tag, char *file, int line, const char *funcname);
+void *__ao2_link_debug(struct ao2_container *c, void *new_obj, int flags, const char *tag, char *file, int line, const char *funcname);
 void *__ao2_link(struct ao2_container *c, void *newobj, int flags);
 
 /*!
@@ -830,7 +830,7 @@ void *__ao2_link(struct ao2_container *c, void *newobj, int flags);
 
 #endif
 
-void *__ao2_unlink_debug(struct ao2_container *c, void *obj, int flags, char *tag, char *file, int line, const char *funcname);
+void *__ao2_unlink_debug(struct ao2_container *c, void *obj, int flags, const char *tag, char *file, int line, const char *funcname);
 void *__ao2_unlink(struct ao2_container *c, void *obj, int flags);
 
 
@@ -924,7 +924,7 @@ void *__ao2_unlink(struct ao2_container *c, void *obj, int flags);
 #endif
 
 void *__ao2_callback_debug(struct ao2_container *c, enum search_flags flags, ao2_callback_fn *cb_fn,
-			   void *arg, char *tag, char *file, int line, const char *funcname);
+			   void *arg, const char *tag, char *file, int line, const char *funcname);
 void *__ao2_callback(struct ao2_container *c, enum search_flags flags, ao2_callback_fn *cb_fn, void *arg);
 
 /*! @} */
@@ -957,7 +957,7 @@ void *__ao2_callback(struct ao2_container *c, enum search_flags flags, ao2_callb
 #endif
 
 void *__ao2_callback_data_debug(struct ao2_container *c, enum search_flags flags,
-				ao2_callback_data_fn *cb_fn, void *arg, void *data, char *tag,
+				ao2_callback_data_fn *cb_fn, void *arg, void *data, const char *tag,
 				char *file, int line, const char *funcname);
 void *__ao2_callback_data(struct ao2_container *c, enum search_flags flags,
 			  ao2_callback_data_fn *cb_fn, void *arg, void *data);
@@ -977,7 +977,7 @@ void *__ao2_callback_data(struct ao2_container *c, enum search_flags flags,
 
 #endif
 
-void *__ao2_find_debug(struct ao2_container *c, const void *arg, enum search_flags flags, char *tag,
+void *__ao2_find_debug(struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag,
 		       char *file, int line, const char *funcname);
 void *__ao2_find(struct ao2_container *c, const void *arg, enum search_flags flags);
 
@@ -1139,7 +1139,7 @@ void ao2_iterator_destroy(struct ao2_iterator *i);
 
 #endif
 
-void *__ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname);
+void *__ao2_iterator_next_debug(struct ao2_iterator *a, const char *tag, char *file, int line, const char *funcname);
 void *__ao2_iterator_next(struct ao2_iterator *a);
 
 /* extra functions */
diff --git a/main/astobj2.c b/main/astobj2.c
index df5e2ef0a8..87b0889195 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -140,7 +140,7 @@ static struct ao2_container *internal_ao2_container_alloc(struct ao2_container *
 static struct bucket_entry *internal_ao2_link(struct ao2_container *c, void *user_data, int flags, const char *file, int line, const char *func);
 static void *internal_ao2_callback(struct ao2_container *c,
 				   const enum search_flags flags, void *cb_fn, void *arg, void *data, enum ao2_callback_type type,
-				   char *tag, char *file, int line, const char *funcname);
+				   const char *tag, char *file, int line, const char *funcname);
 static void *internal_ao2_iterator_next(struct ao2_iterator *a, struct bucket_entry **q);
 
 int __ao2_lock(void *user_data, const char *file, const char *func, int line, const char *var)
@@ -202,7 +202,7 @@ void *ao2_object_get_lockaddr(void *obj)
  */
 
 
-int __ao2_ref_debug(void *user_data, const int delta, char *tag, char *file, int line, const char *funcname)
+int __ao2_ref_debug(void *user_data, const int delta, const char *tag, char *file, int line, const char *funcname)
 {
 	struct astobj2 *obj = INTERNAL_OBJ(user_data);
 	
@@ -319,7 +319,7 @@ static void *internal_ao2_alloc(size_t data_size, ao2_destructor_fn destructor_f
 	return EXTERNAL_OBJ(obj);
 }
 
-void *__ao2_alloc_debug(size_t data_size, ao2_destructor_fn destructor_fn, char *tag,
+void *__ao2_alloc_debug(size_t data_size, ao2_destructor_fn destructor_fn, const char *tag,
 			const char *file, int line, const char *funcname, int ref_debug)
 {
 	/* allocation */
@@ -427,7 +427,7 @@ static struct ao2_container *internal_ao2_container_alloc(struct ao2_container *
 }
 
 struct ao2_container *__ao2_container_alloc_debug(const unsigned int n_buckets, ao2_hash_fn *hash_fn,
-						  ao2_callback_fn *cmp_fn, char *tag, char *file, int line,
+						  ao2_callback_fn *cmp_fn, const char *tag, char *file, int line,
 						  const char *funcname, int ref_debug)
 {
 	/* XXX maybe consistency check on arguments ? */
@@ -507,7 +507,7 @@ static struct bucket_entry *internal_ao2_link(struct ao2_container *c, void *use
 	return p;
 }
 
-void *__ao2_link_debug(struct ao2_container *c, void *user_data, int flags, char *tag, char *file, int line, const char *funcname)
+void *__ao2_link_debug(struct ao2_container *c, void *user_data, int flags, const char *tag, char *file, int line, const char *funcname)
 {
 	struct bucket_entry *p = internal_ao2_link(c, user_data, flags, file, line, funcname);
 
@@ -545,7 +545,7 @@ int ao2_match_by_addr(void *user_data, void *arg, int flags)
  * Unlink an object from the container
  * and destroy the associated * bucket_entry structure.
  */
-void *__ao2_unlink_debug(struct ao2_container *c, void *user_data, int flags, char *tag,
+void *__ao2_unlink_debug(struct ao2_container *c, void *user_data, int flags, const char *tag,
 			 char *file, int line, const char *funcname)
 {
 	if (INTERNAL_OBJ(user_data) == NULL)	/* safety check on the argument */
@@ -595,7 +595,7 @@ static int cb_true_data(void *user_data, void *arg, void *data, int flags)
  */
 static void *internal_ao2_callback(struct ao2_container *c,
 				   const enum search_flags flags, void *cb_fn, void *arg, void *data, enum ao2_callback_type type,
-				   char *tag, char *file, int line, const char *funcname)
+				   const char *tag, char *file, int line, const char *funcname)
 {
 	int i, start, last;	/* search boundaries */
 	void *ret = NULL;
@@ -775,7 +775,7 @@ static void *internal_ao2_callback(struct ao2_container *c,
 }
 
 void *__ao2_callback_debug(struct ao2_container *c, enum search_flags flags,
-	ao2_callback_fn *cb_fn, void *arg, char *tag, char *file, int line,
+	ao2_callback_fn *cb_fn, void *arg, const char *tag, char *file, int line,
 	const char *funcname)
 {
 	return internal_ao2_callback(c,flags, cb_fn, arg, NULL, DEFAULT, tag, file, line, funcname);
@@ -790,7 +790,7 @@ void *__ao2_callback(struct ao2_container *c, enum search_flags flags,
 void *__ao2_callback_data_debug(struct ao2_container *c,
 				const enum search_flags flags,
 				ao2_callback_data_fn *cb_fn, void *arg, void *data,
-				char *tag, char *file, int line, const char *funcname)
+				const char *tag, char *file, int line, const char *funcname)
 {
 	return internal_ao2_callback(c, flags, cb_fn, arg, data, WITH_DATA, tag, file, line, funcname);
 }
@@ -804,7 +804,7 @@ void *__ao2_callback_data(struct ao2_container *c, const enum search_flags flags
 /*!
  * the find function just invokes the default callback with some reasonable flags.
  */
-void *__ao2_find_debug(struct ao2_container *c, const void *arg, enum search_flags flags, char *tag, char *file, int line, const char *funcname)
+void *__ao2_find_debug(struct ao2_container *c, const void *arg, enum search_flags flags, const char *tag, char *file, int line, const char *funcname)
 {
 	void *arged = (void *) arg;/* Done to avoid compiler const warning */
 
@@ -916,7 +916,7 @@ found:
 	return ret;
 }
 
-void *__ao2_iterator_next_debug(struct ao2_iterator *a, char *tag, char *file, int line, const char *funcname)
+void *__ao2_iterator_next_debug(struct ao2_iterator *a, const char *tag, char *file, int line, const char *funcname)
 {
 	struct bucket_entry *p;
 	void *ret = NULL;
-- 
GitLab