Hi I have removed the references to object_iter() & object_iter_reset()
I would lint more c files but splint is having issues with #including syslog.h http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;bug=498809 Regards -Angus objdb: remove all references to object_iter() & object_iter_reset() from the API extern objdb_iface so it is not declared twice. rename the array objdb_iface_ver0 for clarity (it is also a type) totempg: convert some assert (pointer) to assert (pointer != NULL) in totempg_deliver_fn() move the assert above the top most usage of the pointer. lint prefers snprintf --- exec/Makefile | 4 ++++ exec/apidef.c | 2 -- exec/objdb.c | 8 ++++---- exec/totempg.c | 12 +++++++----- include/corosync/engine/coroapi.h | 9 --------- include/corosync/engine/objdb.h | 9 --------- 6 files changed, 15 insertions(+), 29 deletions(-) diff --git a/exec/Makefile b/exec/Makefile index 307d5ff..b0cdeee 100644 --- a/exec/Makefile +++ b/exec/Makefile @@ -137,6 +137,10 @@ liblogsys.so.2.0.0: $(LIBLOGSYS_OBJS) endif +lint: + splint -weak +posixlib +ignoresigns -fcnuse -badflag $(CFLAGS) objdb.c + splint -weak +posixlib +ignoresigns -fcnuse -badflag $(CFLAGS) totempg.c + clean: rm -f corosync $(OBJS) *.o *.lcrso libtotem_pg.so* libtotem_pg.a gmon.out rm -f *.da *.bb *.bbg liblogsys.so* liblogsys.a diff --git a/exec/apidef.c b/exec/apidef.c index 0bf2795..69f92df 100644 --- a/exec/apidef.c +++ b/exec/apidef.c @@ -122,8 +122,6 @@ void apidef_init (struct objdb_iface_ver0 *objdb) { apidef_corosync_api_v1.object_priv_get = objdb->object_priv_get; apidef_corosync_api_v1.object_key_replace = objdb->object_key_replace; apidef_corosync_api_v1.object_key_delete = objdb->object_key_delete; - apidef_corosync_api_v1.object_iter_reset = objdb->object_iter_reset; - apidef_corosync_api_v1.object_iter = objdb->object_iter; apidef_corosync_api_v1.object_key_iter = objdb->object_key_iter; apidef_corosync_api_v1.object_parent_get = objdb->object_parent_get; apidef_corosync_api_v1.object_name_get = objdb->object_name_get; diff --git a/exec/objdb.c b/exec/objdb.c index b0b60bb..6e5edf7 100644 --- a/exec/objdb.c +++ b/exec/objdb.c @@ -90,7 +90,7 @@ struct object_find_instance { int object_len; }; -struct objdb_iface_ver0 objdb_iface; +extern struct objdb_iface_ver0 objdb_iface; struct list_head objdb_trackers_head; static pthread_rwlock_t reload_lock; static pthread_t lock_thread; @@ -1563,7 +1563,7 @@ struct objdb_iface_ver0 objdb_iface = { .object_key_decrement = object_key_decrement, }; -struct lcr_iface objdb_iface_ver0[1] = { +struct lcr_iface objdb_iface_array_ver0[1] = { { .name = "objdb", .version = 0, @@ -1579,13 +1579,13 @@ struct lcr_iface objdb_iface_ver0[1] = { struct lcr_comp objdb_comp_ver0 = { .iface_count = 1, - .ifaces = objdb_iface_ver0 + .ifaces = objdb_iface_array_ver0 }; __attribute__ ((constructor)) static void objdb_comp_register (void) { - lcr_interfaces_set (&objdb_iface_ver0[0], &objdb_iface); + lcr_interfaces_set (&objdb_iface_array_ver0[0], &objdb_iface); lcr_component_register (&objdb_comp_ver0); } diff --git a/exec/totempg.c b/exec/totempg.c index 00dfc99..e811126 100644 --- a/exec/totempg.c +++ b/exec/totempg.c @@ -266,7 +266,7 @@ static struct assembly *assembly_ref (unsigned int nodeid) /* * TODO handle memory allocation failure here */ - assert (assembly); + assert (assembly != NULL); assembly->nodeid = nodeid; list_init (&assembly->list); list_add (&assembly->list, &assembly_list_inuse); @@ -475,7 +475,7 @@ static void totempg_deliver_fn ( int start; assembly = assembly_ref (nodeid); - assert (assembly); + assert (assembly != NULL); /* * Assemble the header into one block of data and @@ -489,6 +489,7 @@ static void totempg_deliver_fn ( char *data; int datasize; + assert(iovec != NULL); mcast = (struct totempg_mcast *)iovec[0].iov_base; if (endian_conversion_required) { mcast->msg_count = swab16 (mcast->msg_count); @@ -497,9 +498,10 @@ static void totempg_deliver_fn ( msg_count = mcast->msg_count; datasize = sizeof (struct totempg_mcast) + msg_count * sizeof (unsigned short); - + + assert (datasize < FRAME_SIZE_MAX); + memcpy (header, iovec[0].iov_base, datasize); - assert(iovec); data = iovec[0].iov_base; msg_lens = (unsigned short *) (header + sizeof (struct totempg_mcast)); @@ -1236,7 +1238,7 @@ char *totempg_ifaces_print (unsigned int nodeid) } for (i = 0; i < iface_count; i++) { - sprintf (one_iface, "r(%d) ip(%s) ", + snprintf (one_iface, 64, "r(%d) ip(%s) ", i, totemip_print (&interfaces[i])); strcat (iface_string, one_iface); } diff --git a/include/corosync/engine/coroapi.h b/include/corosync/engine/coroapi.h index e5b0454..9ac305f 100644 --- a/include/corosync/engine/coroapi.h +++ b/include/corosync/engine/coroapi.h @@ -248,15 +248,6 @@ struct corosync_api_v1 { void *value, int value_len); - int (*object_iter_reset) ( - unsigned int parent_object_handle); - - int (*object_iter) ( - unsigned int parent_object_handle, - void **object_name, - int *name_len, - unsigned int *object_handle); - int (*object_key_iter_reset) ( unsigned int object_handle); diff --git a/include/corosync/engine/objdb.h b/include/corosync/engine/objdb.h index 507b741..7aea637 100644 --- a/include/corosync/engine/objdb.h +++ b/include/corosync/engine/objdb.h @@ -162,15 +162,6 @@ struct objdb_iface_ver0 { void *value, int value_len); - int (*object_iter_reset) ( - unsigned int parent_object_handle); - - int (*object_iter) ( - unsigned int parent_object_handle, - void **object_name, - int *name_len, - unsigned int *object_handle); - int (*object_key_iter_reset) ( unsigned int object_handle); -- 1.5.6 _______________________________________________ Openais mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/openais
