[asterisk-commits] mmichelson: branch group/asterisk-cpp r168386 - in /team/group/asterisk-cpp: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 10 16:36:26 CST 2009


Author: mmichelson
Date: Sat Jan 10 16:36:26 2009
New Revision: 168386

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168386
Log:
astobj2.c compiles now


Modified:
    team/group/asterisk-cpp/include/asterisk/astobj2.h
    team/group/asterisk-cpp/main/astobj2.c

Modified: team/group/asterisk-cpp/include/asterisk/astobj2.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/astobj2.h?view=diff&rev=168386&r1=168385&r2=168386
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/astobj2.h (original)
+++ team/group/asterisk-cpp/include/asterisk/astobj2.h Sat Jan 10 16:36:26 2009
@@ -983,11 +983,11 @@
 	/*! current bucket */
 	int bucket;
 	/*! container version */
-	unsigned int c_version;
+	int c_version;
 	/*! pointer to the current object */
 	void *obj;
 	/*! container version when the object was created */
-	unsigned int version;
+	int version;
 };
 
 /* the flags field can contain F_AO2I_DONTLOCK, which will prevent 

Modified: team/group/asterisk-cpp/main/astobj2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/astobj2.c?view=diff&rev=168386&r1=168385&r2=168386
==============================================================================
--- team/group/asterisk-cpp/main/astobj2.c (original)
+++ team/group/asterisk-cpp/main/astobj2.c Sat Jan 10 16:36:26 2009
@@ -141,7 +141,7 @@
 static struct bucket_list *__ao2_link(struct ao2_container *c, void *user_data);
 static void *__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, const char *file, const int line, const char *funcname);
 static void * __ao2_iterator_next(struct ao2_iterator *a, struct bucket_list **q);
 
 #ifndef DEBUG_THREADS
@@ -218,7 +218,7 @@
  */
 
 
-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, const char *file, const int line, const char *funcname)
 {
 	struct astobj2 *obj = INTERNAL_OBJ(user_data);
 	
@@ -588,7 +588,7 @@
  */
 static void *__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, const char *file, const int line, const char *funcname)
 {
 	int i, last;	/* search boundaries */
 	void *ret = NULL;
@@ -614,9 +614,9 @@
 		/* We do this here to avoid the per object casting penalty (even though
 		   that is probably optimized away anyway. */
 		if (type == WITH_DATA) {
-			cb_withdata = cb_fn;
+			cb_withdata = (ao2_callback_data_fn *) cb_fn;
 		} else {
-			cb_default = cb_fn;
+			cb_default = (ao2_callback_fn *) cb_fn;
 		}
 	}
 
@@ -709,15 +709,15 @@
 void *_ao2_callback_debug(struct ao2_container *c,
 						 const enum search_flags flags,
 						 ao2_callback_fn *cb_fn, void *arg,
-						 char *tag, char *file, int line, const char *funcname)
-{
-	return __ao2_callback(c,flags, cb_fn, arg, NULL, DEFAULT, tag, file, line, funcname);
+						 const char *tag, const char *file, const int line, const char *funcname)
+{
+	return __ao2_callback(c,flags, (void *) cb_fn, arg, NULL, DEFAULT, tag, file, line, funcname);
 }
 
 void *_ao2_callback(struct ao2_container *c, const enum search_flags flags,
                     ao2_callback_fn *cb_fn, void *arg)
 {
-	return __ao2_callback(c,flags, cb_fn, arg, NULL, DEFAULT, NULL, NULL, 0, NULL);
+	return __ao2_callback(c, flags, (void *) cb_fn, arg, NULL, DEFAULT, NULL, NULL, 0, NULL);
 }
 
 void *_ao2_callback_data_debug(struct ao2_container *c,
@@ -725,13 +725,13 @@
 						 ao2_callback_data_fn *cb_fn, void *arg, void *data,
 						 char *tag, char *file, int line, const char *funcname)
 {
-	return __ao2_callback(c, flags, cb_fn, arg, data, WITH_DATA, tag, file, line, funcname);
+	return __ao2_callback(c, flags, (void *)cb_fn, arg, data, WITH_DATA, tag, file, line, funcname);
 }
 
 void *_ao2_callback_data(struct ao2_container *c, const enum search_flags flags,
 					ao2_callback_data_fn *cb_fn, void *arg, void *data)
 {
-	return __ao2_callback(c, flags, cb_fn, arg, data, WITH_DATA, NULL, NULL, 0, NULL);
+	return __ao2_callback(c, flags, (void *) cb_fn, arg, data, WITH_DATA, NULL, NULL, 0, NULL);
 }
 
 /*!
@@ -753,8 +753,12 @@
 struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags)
 {
 	struct ao2_iterator a = {
-		.c = c,
-		.flags = flags
+		c,
+		flags,
+		0,
+		0u,
+		NULL,
+		0u
 	};
 	
 	return a;
@@ -780,7 +784,7 @@
 	/* optimization. If the container is unchanged and
 	 * we have a pointer, try follow it
 	 */
-	if (a->c->version == a->c_version && (p = a->obj) ) {
+	if (a->c->version == a->c_version && (p = (struct bucket_list *) a->obj) ) {
 		if ( (p = AST_LIST_NEXT(p, entry)) )
 			goto found;
 		/* nope, start from the next bucket */
@@ -871,7 +875,7 @@
 	
 static void container_destruct(void *_c)
 {
-	struct ao2_container *c = _c;
+	struct ao2_container *c = (struct ao2_container *) _c;
 	int i;
 
 	_ao2_callback(c, OBJ_UNLINK, cd_cb, NULL);
@@ -891,10 +895,10 @@
 
 static void container_destruct_debug(void *_c)
 {
-	struct ao2_container *c = _c;
+	struct ao2_container *c = (struct ao2_container *) _c;
 	int i;
 
-	_ao2_callback_debug(c, OBJ_UNLINK, cd_cb_debug, NULL, "container_destruct_debug called", __FILE__, __LINE__, __PRETTY_FUNCTION__);
+	_ao2_callback_debug(c, OBJ_UNLINK, (ao2_callback_fn *) cd_cb_debug, NULL, "container_destruct_debug called", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 
 	for (i = 0; i < c->n_buckets; i++) {
 		struct bucket_list *current;
@@ -912,7 +916,7 @@
 #ifdef AO2_DEBUG
 static int print_cb(void *obj, void *arg, int flag)
 {
-	int *fd = arg;
+	int *fd = (int *) arg;
 	char *s = (char *)obj;
 
 	ast_cli(*fd, "string <%s>\n", s);
@@ -989,7 +993,7 @@
 	 */
 	for (i = 0; i < lim; i++) {
 		ast_mark(prof_id, 1 /* start */);
-		obj = ao2_t_alloc(80, NULL,"test");
+		obj = (char *)ao2_t_alloc(80, NULL,"test");
 		ast_mark(prof_id, 0 /* stop */);
 		ast_cli(a->fd, "object %d allocated as %p\n", i, obj);
 		sprintf(obj, "-- this is obj %d --", i);
@@ -1002,14 +1006,14 @@
 		ao2_t_ref(obj, -1, "test");
 	}
 	ast_cli(a->fd, "testing callbacks\n");
-	ao2_t_callback(c1, 0, print_cb, &a->fd, "test callback");
+	ao2_t_callback(c1, (search_flags) 0, (ao2_callback_fn *) print_cb, &a->fd, "test callback");
 	ast_cli(a->fd, "testing iterators, remove every second object\n");
 	{
 		struct ao2_iterator ai;
 		int x = 0;
 
 		ai = ao2_iterator_init(c1, 0);
-		while ( (obj = ao2_t_iterator_next(&ai,"test")) ) {
+		while ( (obj = (char *) ao2_t_iterator_next(&ai,"test")) ) {
 			ast_cli(a->fd, "iterator on <%s>\n", obj);
 			if (x++ & 1)
 				ao2_t_unlink(c1, obj,"test");
@@ -1017,13 +1021,13 @@
 		}
 		ast_cli(a->fd, "testing iterators again\n");
 		ai = ao2_iterator_init(c1, 0);
-		while ( (obj = ao2_t_iterator_next(&ai,"test")) ) {
+		while ( (obj = (char *) ao2_t_iterator_next(&ai,"test")) ) {
 			ast_cli(a->fd, "iterator on <%s>\n", obj);
 			ao2_t_ref(obj, -1,"test");
 		}
 	}
 	ast_cli(a->fd, "testing callbacks again\n");
-	ao2_t_callback(c1, 0, print_cb, &a->fd, "test callback");
+	ao2_t_callback(c1, (search_flags) 0, (ao2_callback_fn *) print_cb, &a->fd, "test callback");
 
 	ast_verbose("now you should see an error message:\n");
 	ao2_t_ref(&i, -1, "");	/* i is not a valid object so we print an error here */
@@ -1035,8 +1039,8 @@
 }
 
 static struct ast_cli_entry cli_astobj2[] = {
-	AST_CLI_DEFINE(handle_astobj2_stats, "Print astobj2 statistics"),
-	AST_CLI_DEFINE(handle_astobj2_test, "Test astobj2"),
+	ast_cli_entry(handle_astobj2_stats, "Print astobj2 statistics"),
+	ast_cli_entry(handle_astobj2_test, "Test astobj2"),
 };
 #endif /* AO2_DEBUG */
 




More information about the asterisk-commits mailing list