Reviewed-by: Steven Dake <[email protected]>

On 08/05/2011 12:09 AM, Angus Salkeld wrote:
> Signed-off-by: Angus Salkeld <[email protected]>
> ---
>  configure.ac      |    4 +-
>  exec/crypto.c     |    2 -
>  exec/main.c       |    3 --
>  exec/objdb.c      |   76 ++++++++++++++++++++++++++++------------------------
>  lib/confdb.c      |    3 ++
>  services/confdb.c |    7 +++-
>  services/cpg.c    |    2 -
>  7 files changed, 51 insertions(+), 46 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 92aed9e..35e3cfb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -173,9 +173,9 @@ LIB_MSG_RESULT(m4_shift(m4_shift($@)))dnl
>  
>  ## helper for CC stuff
>  cc_supports_flag() {
> -     local CFLAGS="$@"
> +     local CPPFLAGS="$CPPFLAGS $@"
>       AC_MSG_CHECKING([whether $CC supports "$@"])
> -     AC_COMPILE_IFELSE([int main(){return 0;}] ,
> +     AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
>                         [RC=0; AC_MSG_RESULT([yes])],
>                         [RC=1; AC_MSG_RESULT([no])])
>       return $RC
> diff --git a/exec/crypto.c b/exec/crypto.c
> index 901797a..14fb807 100644
> --- a/exec/crypto.c
> +++ b/exec/crypto.c
> @@ -1140,12 +1140,10 @@ int sha1_done(hash_state * md, unsigned char *hash)
>  int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned 
> long keylen)
>  {
>      unsigned char buf[128];
> -    unsigned long hashsize;
>      unsigned long i;
>      int err;
>  
>      hmac->hash = hash;
> -    hashsize   = hash_descriptor[hash]->hashsize;
>  
>      /* valid key length? */
>       assert (keylen > 0);
> diff --git a/exec/main.c b/exec/main.c
> index 006f846..e33a397 100644
> --- a/exec/main.c
> +++ b/exec/main.c
> @@ -807,16 +807,13 @@ static void deliver_fn (
>       int32_t service;
>       int32_t fn_id;
>       uint32_t id;
> -     uint32_t size;
>       uint32_t key_incr_dummy;
>  
>       header = msg;
>       if (endian_conversion_required) {
>               id = swab32 (header->id);
> -             size = swab32 (header->size);
>       } else {
>               id = header->id;
> -             size = header->size;
>       }
>  
>       /*
> diff --git a/exec/objdb.c b/exec/objdb.c
> index 99e20ec..999db61 100644
> --- a/exec/objdb.c
> +++ b/exec/objdb.c
> @@ -112,7 +112,7 @@ static int objdb_init (void)
>  {
>       hdb_handle_t handle;
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_create (&object_instance_database,
>               sizeof (struct object_instance), &handle);
> @@ -192,11 +192,12 @@ static void object_created_notification(
>       struct object_instance * obj_pt;
>       struct object_tracker * tracker_pt;
>       hdb_handle_t obj_handle = object_handle;
> -     unsigned int res;
>  
>       do {
> -             res = hdb_handle_get (&object_instance_database,
> -                     obj_handle, (void *)&obj_pt);
> +             if (hdb_handle_get (&object_instance_database,
> +                     obj_handle, (void *)&obj_pt) != 0) {
> +                     return;
> +             }
>  
>               for (list = obj_pt->track_head.next;
>                       list != &obj_pt->track_head; list = list->next) {
> @@ -226,11 +227,12 @@ static void 
> object_pre_deletion_notification(hdb_handle_t object_handle,
>       struct object_instance * obj_pt;
>       struct object_tracker * tracker_pt;
>       hdb_handle_t obj_handle = object_handle;
> -     unsigned int res;
>  
>       do {
> -             res = hdb_handle_get (&object_instance_database,
> -                     obj_handle, (void *)&obj_pt);
> +             if (hdb_handle_get (&object_instance_database,
> +                     obj_handle, (void *)&obj_pt) != 0) {
> +                     return;
> +             }
>  
>               for (list = obj_pt->track_head.next;
>                       list != &obj_pt->track_head; list = list->next) {
> @@ -265,11 +267,12 @@ static void 
> object_key_changed_notification(hdb_handle_t object_handle,
>       struct object_instance * owner_pt = NULL;
>       struct object_tracker * tracker_pt;
>       hdb_handle_t obj_handle = object_handle;
> -     unsigned int res;
>  
>       do {
> -             res = hdb_handle_get (&object_instance_database,
> -                     obj_handle, (void *)&obj_pt);
> +             if (hdb_handle_get (&object_instance_database,
> +                     obj_handle, (void *)&obj_pt) != 0) {
> +                     return;
> +             }
>  
>               if (owner_pt == NULL)
>                       owner_pt = obj_pt;
> @@ -302,10 +305,11 @@ static void object_reload_notification(int startstop, 
> int flush)
>       struct object_instance * obj_pt;
>       struct object_tracker * tracker_pt;
>       struct object_tracker * tmptracker_pt;
> -     unsigned int res;
>  
> -     res = hdb_handle_get (&object_instance_database,
> -             OBJECT_PARENT_HANDLE, (void *)&obj_pt);
> +     if (hdb_handle_get (&object_instance_database,
> +             OBJECT_PARENT_HANDLE, (void *)&obj_pt) != 0) {
> +             return;
> +     }
>  
>       /*
>        * Make a copy of the list
> @@ -350,7 +354,7 @@ static int object_create (
>  {
>       struct object_instance *object_instance;
>       struct object_instance *parent_instance;
> -     unsigned int res;
> +     int res;
>       int found = 0;
>       int i;
>  
> @@ -473,7 +477,7 @@ static int object_key_create_typed(
>  {
>       struct object_instance *instance;
>       struct object_key *object_key;
> -     unsigned int res;
> +     int res;
>       struct list_head *list;
>       int found = 0;
>       int i;
> @@ -698,7 +702,7 @@ static int object_destroy (
>       hdb_handle_t object_handle)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_instance_database,
>               object_handle, (void *)&instance);
> @@ -728,7 +732,7 @@ static int object_valid_set (
>       size_t object_valid_list_entries)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_instance_database,
>               object_handle, (void *)&instance);
> @@ -753,7 +757,7 @@ static int object_key_valid_set (
>       size_t object_key_valid_list_entries)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_instance_database,
>               object_handle, (void *)&instance);
> @@ -781,7 +785,7 @@ static int object_find_create (
>       size_t object_len,
>       hdb_handle_t *object_find_handle)
>  {
> -     unsigned int res;
> +     int res;
>       struct object_instance *iter_obj_inst;
>       struct object_instance *object_instance;
>       struct object_find_instance *object_find_instance;
> @@ -873,10 +877,10 @@ static int object_find_next (
>       hdb_handle_t object_find_handle,
>       hdb_handle_t *object_handle)
>  {
> -     unsigned int res;
> +     int res;
>       struct object_find_instance *object_find_instance;
>       struct object_instance *object_instance = NULL;
> -     unsigned int found = 0;
> +     int found = 0;
>          size_t pos;
>  
>       res = hdb_handle_get (&object_find_instance_database,
> @@ -915,6 +919,8 @@ static int object_find_next (
>       if (found) {
>               *object_handle = object_instance->object_handle;
>               res = 0;
> +     } else {
> +             res = -1;
>       }
>       return (res);
>  
> @@ -926,7 +932,7 @@ static int object_find_destroy (
>       hdb_handle_t object_find_handle)
>  {
>       struct object_find_instance *object_find_instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_find_instance_database,
>               object_find_handle, (void *)&object_find_instance);
> @@ -952,7 +958,7 @@ static int object_key_get_typed (
>       size_t *value_len,
>       objdb_value_types_t * type)
>  {
> -     unsigned int res = 0;
> +     int res = 0;
>       struct object_instance *instance;
>       struct object_key *object_key = NULL;
>       struct list_head *list;
> @@ -1027,7 +1033,7 @@ static int object_key_increment (
>       size_t key_len,
>       unsigned int *value)
>  {
> -     unsigned int res = 0;
> +     int res = 0;
>       struct object_instance *instance;
>       struct object_key *object_key = NULL;
>       struct list_head *list;
> @@ -1110,7 +1116,7 @@ static int object_key_decrement (
>       size_t key_len,
>       unsigned int *value)
>  {
> -     unsigned int res = 0;
> +     int res = 0;
>       struct object_instance *instance;
>       struct object_key *object_key = NULL;
>       struct list_head *list;
> @@ -1193,7 +1199,7 @@ static int object_key_delete (
>       const void *key_name,
>       size_t key_len)
>  {
> -     unsigned int res;
> +     int res;
>       int ret = 0;
>       struct object_instance *instance;
>       struct object_key *object_key = NULL;
> @@ -1245,7 +1251,7 @@ static int object_key_replace (
>       const void *new_value,
>       size_t new_value_len)
>  {
> -     unsigned int res;
> +     int res;
>       int ret = 0;
>       struct object_instance *instance;
>       struct object_key *object_key = NULL;
> @@ -1452,7 +1458,7 @@ static int _dump_object(struct object_instance 
> *instance, FILE *file, int depth)
>  
>  static int object_key_iter_reset(hdb_handle_t object_handle)
>  {
> -     unsigned int res;
> +     int res;
>       struct object_instance *instance;
>  
>       res = hdb_handle_get (&object_instance_database,
> @@ -1475,7 +1481,7 @@ static int object_key_iter_typed (hdb_handle_t 
> parent_object_handle,
>       size_t *value_len,
>       objdb_value_types_t *type)
>  {
> -     unsigned int res;
> +     int res;
>       struct object_instance *instance;
>       struct object_key *find_key = NULL;
>       struct list_head *list;
> @@ -1538,7 +1544,7 @@ static int object_key_iter_from(hdb_handle_t 
> parent_object_handle,
>       size_t *value_len)
>  {
>       unsigned int pos = 0;
> -     unsigned int res;
> +     int res;
>       struct object_instance *instance;
>       struct object_key *find_key = NULL;
>       struct list_head *list;
> @@ -1587,7 +1593,7 @@ static int object_parent_get(hdb_handle_t object_handle,
>       hdb_handle_t *parent_handle)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_instance_database,
>               object_handle, (void *)&instance);
> @@ -1610,7 +1616,7 @@ static int object_name_get(hdb_handle_t object_handle,
>       size_t *object_name_len)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_instance_database,
>               object_handle, (void *)&instance);
> @@ -1636,7 +1642,7 @@ static int object_track_start(hdb_handle_t 
> object_handle,
>       void * priv_data_pt)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>       struct object_tracker * tracker_pt;
>  
>       res = hdb_handle_get (&object_instance_database,
> @@ -1676,7 +1682,7 @@ static void 
> object_track_stop(object_key_change_notify_fn_t key_change_notify_fn
>       struct object_tracker * obj_tracker_pt = NULL;
>       struct list_head *list, *tmp_list;
>       struct list_head *obj_list, *tmp_obj_list;
> -     unsigned int res;
> +     int res;
>  
>       /* go through the global list and find all the trackers to stop */
>       for (list = objdb_trackers_head.next, tmp_list = list->next;
> @@ -1718,7 +1724,7 @@ static int object_dump(hdb_handle_t object_handle,
>       FILE *file)
>  {
>       struct object_instance *instance;
> -     unsigned int res;
> +     int res;
>  
>       res = hdb_handle_get (&object_instance_database,
>               object_handle, (void *)&instance);
> diff --git a/lib/confdb.c b/lib/confdb.c
> index 51a8c34..831b5cc 100644
> --- a/lib/confdb.c
> +++ b/lib/confdb.c
> @@ -1809,3 +1809,6 @@ error_exit:
>       return (error);
>  }
>  
> +/**
> + * @}
> + */
> diff --git a/services/confdb.c b/services/confdb.c
> index c04b735..c67f537 100644
> --- a/services/confdb.c
> +++ b/services/confdb.c
> @@ -43,8 +43,10 @@
>  #include <poll.h>
>  #include <assert.h>
>  
> -#include <corosync/corotypes.h>
> +#include <qb/qbloop.h>
>  #include <qb/qbipc_common.h>
> +
> +#include <corosync/corotypes.h>
>  #include <corosync/corodefs.h>
>  #include <corosync/cfg.h>
>  #include <corosync/list.h>
> @@ -53,7 +55,6 @@
>  #include <corosync/lcr/lcr_comp.h>
>  #include <corosync/engine/logsys.h>
>  #include <corosync/engine/coroapi.h>
> -#include <corosync/totem/coropoll.h>
>  
>  LOGSYS_DECLARE_SUBSYS ("CONFDB");
>  
> @@ -91,6 +92,8 @@ static int fd_set_nonblocking(int fd);
>  static int objdb_notify_dispatch(hdb_handle_t handle,
>               int fd, int revents, void *data);
>  
> +
> +
>  static int confdb_lib_init_fn (void *conn);
>  static int confdb_lib_exit_fn (void *conn);
>  
> diff --git a/services/cpg.c b/services/cpg.c
> index e7573c5..633d4b3 100644
> --- a/services/cpg.c
> +++ b/services/cpg.c
> @@ -1721,11 +1721,9 @@ static void message_handler_req_lib_cpg_zc_execute (
>       struct req_lib_cpg_mcast *req_lib_cpg_mcast;
>       int result;
>       cs_error_t error = CS_ERR_NOT_EXIST;
> -     struct coroipcs_zc_header *zc_hdr;
>  
>       log_printf(LOGSYS_LEVEL_DEBUG, "got ZC mcast request on %p\n", conn);
>  
> -     zc_hdr = (struct coroipcs_zc_header *)((char 
> *)serveraddr2void(hdr->server_address));
>       header = (struct qb_ipc_request_header *)(((char 
> *)serveraddr2void(hdr->server_address) + sizeof (struct coroipcs_zc_header)));
>       req_lib_cpg_mcast = (struct req_lib_cpg_mcast *)header;
>  

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to