瀏覽代碼

Fix some "set but not used" warnings [-Wunused-but-set-variable]

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Angus Salkeld 15 年之前
父節點
當前提交
0ad2494ae7
共有 14 個文件被更改,包括 10 次插入57 次删除
  1. 1 4
      exec/logsys.c
  2. 0 3
      exec/main.c
  3. 3 6
      exec/syncv2.c
  4. 1 1
      exec/totemconfig.c
  5. 1 2
      exec/totempg.c
  6. 0 15
      exec/totemsrp.c
  7. 1 5
      exec/totemudp.c
  8. 1 5
      exec/totemudpu.c
  9. 1 3
      lib/coroipcc.c
  10. 0 2
      lib/sam.c
  11. 1 2
      services/cfg.c
  12. 0 2
      services/evs.c
  13. 0 2
      services/votequorum.c
  14. 0 5
      tools/corosync-fplay.c

+ 1 - 4
exec/logsys.c

@@ -378,10 +378,7 @@ static inline void records_reclaim (unsigned int idx, unsigned int words)
 
 
 		words_needed = words + 1;
 		words_needed = words + 1;
 		do {
 		do {
-			unsigned int old_tail;
-
 			words_needed -= flt_data[flt_tail];
 			words_needed -= flt_data[flt_tail];
-			old_tail = flt_tail;
 			flt_tail =
 			flt_tail =
 				(flt_tail +
 				(flt_tail +
 				flt_data[flt_tail]) % (flt_data_size);
 				flt_data[flt_tail]) % (flt_data_size);
@@ -1669,7 +1666,7 @@ void logsys_atexit (void)
 			logsys_wthread_lock();
 			logsys_wthread_lock();
 
 
 			res = sem_getvalue (&logsys_print_finished, &value);
 			res = sem_getvalue (&logsys_print_finished, &value);
-			if (value == 0) {
+			if (res != 0 || value == 0) {
 				logsys_wthread_unlock();
 				logsys_wthread_unlock();
 				return;
 				return;
 			}
 			}

+ 0 - 3
exec/main.c

@@ -864,16 +864,13 @@ static void deliver_fn (
 	int service;
 	int service;
 	int fn_id;
 	int fn_id;
 	unsigned int id;
 	unsigned int id;
-	unsigned int size;
 	unsigned int key_incr_dummy;
 	unsigned int key_incr_dummy;
 
 
 	header = msg;
 	header = msg;
 	if (endian_conversion_required) {
 	if (endian_conversion_required) {
 		id = swab32 (header->id);
 		id = swab32 (header->id);
-		size = swab32 (header->size);
 	} else {
 	} else {
 		id = header->id;
 		id = header->id;
-		size = header->size;
 	}
 	}
 
 
 	/*
 	/*

+ 3 - 6
exec/syncv2.c

@@ -402,7 +402,6 @@ static void memb_determine_message_transmit (void)
 {
 {
 	struct iovec iovec;
 	struct iovec iovec;
 	struct req_exec_memb_determine_message req_exec_memb_determine_message;
 	struct req_exec_memb_determine_message req_exec_memb_determine_message;
-	int res;
 
 
 	req_exec_memb_determine_message.header.size = sizeof (struct req_exec_memb_determine_message);
 	req_exec_memb_determine_message.header.size = sizeof (struct req_exec_memb_determine_message);
 	req_exec_memb_determine_message.header.id = MESSAGE_REQ_SYNC_MEMB_DETERMINE;
 	req_exec_memb_determine_message.header.id = MESSAGE_REQ_SYNC_MEMB_DETERMINE;
@@ -414,7 +413,7 @@ static void memb_determine_message_transmit (void)
 	iovec.iov_base = (char *)&req_exec_memb_determine_message;
 	iovec.iov_base = (char *)&req_exec_memb_determine_message;
 	iovec.iov_len = sizeof (req_exec_memb_determine_message);
 	iovec.iov_len = sizeof (req_exec_memb_determine_message);
 
 
-	res = totempg_groups_mcast_joined (sync_group_handle,
+	(void)totempg_groups_mcast_joined (sync_group_handle,
 		&iovec, 1, TOTEMPG_AGREED);
 		&iovec, 1, TOTEMPG_AGREED);
 }
 }
 
 
@@ -422,7 +421,6 @@ static void barrier_message_transmit (void)
 {
 {
 	struct iovec iovec;
 	struct iovec iovec;
 	struct req_exec_barrier_message req_exec_barrier_message;
 	struct req_exec_barrier_message req_exec_barrier_message;
-	int res;
 
 
 	req_exec_barrier_message.header.size = sizeof (struct req_exec_barrier_message);
 	req_exec_barrier_message.header.size = sizeof (struct req_exec_barrier_message);
 	req_exec_barrier_message.header.id = MESSAGE_REQ_SYNC_BARRIER;
 	req_exec_barrier_message.header.id = MESSAGE_REQ_SYNC_BARRIER;
@@ -433,14 +431,13 @@ static void barrier_message_transmit (void)
 	iovec.iov_base = (char *)&req_exec_barrier_message;
 	iovec.iov_base = (char *)&req_exec_barrier_message;
 	iovec.iov_len = sizeof (req_exec_barrier_message);
 	iovec.iov_len = sizeof (req_exec_barrier_message);
 
 
-	res = totempg_groups_mcast_joined (sync_group_handle,
+	(void)totempg_groups_mcast_joined (sync_group_handle,
 		&iovec, 1, TOTEMPG_AGREED);
 		&iovec, 1, TOTEMPG_AGREED);
 }
 }
 
 
 static void service_build_message_transmit (struct req_exec_service_build_message *service_build_message)
 static void service_build_message_transmit (struct req_exec_service_build_message *service_build_message)
 {
 {
 	struct iovec iovec;
 	struct iovec iovec;
-	int res;
 
 
 	service_build_message->header.size = sizeof (struct req_exec_service_build_message);
 	service_build_message->header.size = sizeof (struct req_exec_service_build_message);
 	service_build_message->header.id = MESSAGE_REQ_SYNC_SERVICE_BUILD;
 	service_build_message->header.id = MESSAGE_REQ_SYNC_SERVICE_BUILD;
@@ -451,7 +448,7 @@ static void service_build_message_transmit (struct req_exec_service_build_messag
 	iovec.iov_base = (void *)service_build_message;
 	iovec.iov_base = (void *)service_build_message;
 	iovec.iov_len = sizeof (struct req_exec_service_build_message);
 	iovec.iov_len = sizeof (struct req_exec_service_build_message);
 
 
-	res = totempg_groups_mcast_joined (sync_group_handle,
+	(void)totempg_groups_mcast_joined (sync_group_handle,
 		&iovec, 1, TOTEMPG_AGREED);
 		&iovec, 1, TOTEMPG_AGREED);
 }
 }
 
 

+ 1 - 1
exec/totemconfig.c

@@ -759,7 +759,7 @@ static int read_keyfile (
 	close (fd);
 	close (fd);
 
 
 	if (res == -1) {
 	if (res == -1) {
-		strerror_r (errno, error_str, 100);
+		strerror_r (saved_errno, error_str, 100);
 		snprintf (error_string_response, sizeof(error_string_response),
 		snprintf (error_string_response, sizeof(error_string_response),
 			"Could not read %s: %s\n",
 			"Could not read %s: %s\n",
 			 key_location, error_str);
 			 key_location, error_str);

+ 1 - 2
exec/totempg.c

@@ -662,7 +662,6 @@ int callback_token_received_fn (enum totem_callback_token_type type,
 {
 {
 	struct totempg_mcast mcast;
 	struct totempg_mcast mcast;
 	struct iovec iovecs[3];
 	struct iovec iovecs[3];
-	int res;
 
 
 	pthread_mutex_lock (&mcast_msg_mutex);
 	pthread_mutex_lock (&mcast_msg_mutex);
 	if (mcast_packed_msg_count == 0) {
 	if (mcast_packed_msg_count == 0) {
@@ -691,7 +690,7 @@ int callback_token_received_fn (enum totem_callback_token_type type,
 	iovecs[1].iov_len = mcast_packed_msg_count * sizeof (unsigned short);
 	iovecs[1].iov_len = mcast_packed_msg_count * sizeof (unsigned short);
 	iovecs[2].iov_base = (void *)&fragmentation_data[0];
 	iovecs[2].iov_base = (void *)&fragmentation_data[0];
 	iovecs[2].iov_len = fragment_size;
 	iovecs[2].iov_len = fragment_size;
-	res = totemmrp_mcast (iovecs, 3, 0);
+	(void)totemmrp_mcast (iovecs, 3, 0);
 
 
 	mcast_packed_msg_count = 0;
 	mcast_packed_msg_count = 0;
 	fragment_size = 0;
 	fragment_size = 0;

+ 0 - 15
exec/totemsrp.c

@@ -2428,7 +2428,6 @@ static int orf_token_rtr (
 	unsigned int res;
 	unsigned int res;
 	unsigned int i, j;
 	unsigned int i, j;
 	unsigned int found;
 	unsigned int found;
-	unsigned int total_entries;
 	struct sq *sort_queue;
 	struct sq *sort_queue;
 	struct rtr_item *rtr_list;
 	struct rtr_item *rtr_list;
 	unsigned int range = 0;
 	unsigned int range = 0;
@@ -2456,8 +2455,6 @@ static int orf_token_rtr (
 			"%s", retransmit_msg);
 			"%s", retransmit_msg);
 	}
 	}
 
 
-	total_entries = orf_token->rtr_list_entries;
-
 	/*
 	/*
 	 * Retransmit messages on orf_token's RTR list from RTR queue
 	 * Retransmit messages on orf_token's RTR list from RTR queue
 	 */
 	 */
@@ -2805,13 +2802,8 @@ static int memb_state_commit_token_send_recovery (
 	struct totemsrp_instance *instance,
 	struct totemsrp_instance *instance,
 	struct memb_commit_token *commit_token)
 	struct memb_commit_token *commit_token)
 {
 {
-	struct srp_addr *addr;
-	struct memb_commit_token_memb_entry *memb_list;
 	unsigned int commit_token_size;
 	unsigned int commit_token_size;
 
 
-	addr = (struct srp_addr *)commit_token->end_of_commit_token;
-	memb_list = (struct memb_commit_token_memb_entry *)(addr + commit_token->addr_entries);
-
 	commit_token->token_seq++;
 	commit_token->token_seq++;
 	commit_token_size = sizeof (struct memb_commit_token) +
 	commit_token_size = sizeof (struct memb_commit_token) +
 		((sizeof (struct srp_addr) +
 		((sizeof (struct srp_addr) +
@@ -2838,13 +2830,8 @@ static int memb_state_commit_token_send_recovery (
 static int memb_state_commit_token_send (
 static int memb_state_commit_token_send (
 	struct totemsrp_instance *instance)
 	struct totemsrp_instance *instance)
 {
 {
-	struct srp_addr *addr;
-	struct memb_commit_token_memb_entry *memb_list;
 	unsigned int commit_token_size;
 	unsigned int commit_token_size;
 
 
-	addr = (struct srp_addr *)instance->commit_token->end_of_commit_token;
-	memb_list = (struct memb_commit_token_memb_entry *)(addr + instance->commit_token->addr_entries);
-
 	instance->commit_token->token_seq++;
 	instance->commit_token->token_seq++;
 	commit_token_size = sizeof (struct memb_commit_token) +
 	commit_token_size = sizeof (struct memb_commit_token) +
 		((sizeof (struct srp_addr) +
 		((sizeof (struct srp_addr) +
@@ -4241,7 +4228,6 @@ static int message_handler_memb_commit_token (
 	int sub_entries;
 	int sub_entries;
 
 
 	struct srp_addr *addr;
 	struct srp_addr *addr;
-	struct memb_commit_token_memb_entry *memb_list;
 
 
 	log_printf (instance->totemsrp_log_level_debug,
 	log_printf (instance->totemsrp_log_level_debug,
 		"got commit token\n");
 		"got commit token\n");
@@ -4253,7 +4239,6 @@ static int message_handler_memb_commit_token (
 	}
 	}
 	memb_commit_token = memb_commit_token_convert;
 	memb_commit_token = memb_commit_token_convert;
 	addr = (struct srp_addr *)memb_commit_token->end_of_commit_token;
 	addr = (struct srp_addr *)memb_commit_token->end_of_commit_token;
-	memb_list = (struct memb_commit_token_memb_entry *)(addr + memb_commit_token->addr_entries);
 
 
 #ifdef TEST_DROP_COMMIT_TOKEN_PERCENTAGE
 #ifdef TEST_DROP_COMMIT_TOKEN_PERCENTAGE
 	if (random()%100 < TEST_DROP_COMMIT_TOKEN_PERCENTAGE) {
 	if (random()%100 < TEST_DROP_COMMIT_TOKEN_PERCENTAGE) {

+ 1 - 5
exec/totemudp.c

@@ -1171,7 +1171,6 @@ static int net_deliver_fn (
 	struct totemudp_instance *instance = (struct totemudp_instance *)data;
 	struct totemudp_instance *instance = (struct totemudp_instance *)data;
 	struct msghdr msg_recv;
 	struct msghdr msg_recv;
 	struct iovec *iovec;
 	struct iovec *iovec;
-	struct security_header *security_header;
 	struct sockaddr_storage system_from;
 	struct sockaddr_storage system_from;
 	int bytes_received;
 	int bytes_received;
 	int res = 0;
 	int res = 0;
@@ -1214,8 +1213,6 @@ static int net_deliver_fn (
 		return (0);
 		return (0);
 	}
 	}
 
 
-	security_header = (struct security_header *)iovec->iov_base;
-
 	iovec->iov_len = bytes_received;
 	iovec->iov_len = bytes_received;
 	if (instance->totem_config->secauth == 1) {
 	if (instance->totem_config->secauth == 1) {
 		/*
 		/*
@@ -1276,7 +1273,6 @@ static void timer_function_netif_check_timeout (
 	void *data)
 	void *data)
 {
 {
 	struct totemudp_instance *instance = (struct totemudp_instance *)data;
 	struct totemudp_instance *instance = (struct totemudp_instance *)data;
-	int res;
 	int interface_up;
 	int interface_up;
 	int interface_num;
 	int interface_num;
 	struct totem_ip_address *bind_address;
 	struct totem_ip_address *bind_address;
@@ -1350,7 +1346,7 @@ static void timer_function_netif_check_timeout (
 	/*
 	/*
 	 * Create and bind the multicast and unicast sockets
 	 * Create and bind the multicast and unicast sockets
 	 */
 	 */
-	res = totemudp_build_sockets (instance,
+	(void)totemudp_build_sockets (instance,
 		&instance->mcast_address,
 		&instance->mcast_address,
 		bind_address,
 		bind_address,
 		&instance->totemudp_sockets,
 		&instance->totemudp_sockets,

+ 1 - 5
exec/totemudpu.c

@@ -1066,7 +1066,6 @@ static int net_deliver_fn (
 	struct totemudpu_instance *instance = (struct totemudpu_instance *)data;
 	struct totemudpu_instance *instance = (struct totemudpu_instance *)data;
 	struct msghdr msg_recv;
 	struct msghdr msg_recv;
 	struct iovec *iovec;
 	struct iovec *iovec;
-	struct security_header *security_header;
 	struct sockaddr_storage system_from;
 	struct sockaddr_storage system_from;
 	int bytes_received;
 	int bytes_received;
 	int res = 0;
 	int res = 0;
@@ -1105,8 +1104,6 @@ static int net_deliver_fn (
 		return (0);
 		return (0);
 	}
 	}
 
 
-	security_header = (struct security_header *)iovec->iov_base;
-
 	iovec->iov_len = bytes_received;
 	iovec->iov_len = bytes_received;
 	if (instance->totem_config->secauth == 1) {
 	if (instance->totem_config->secauth == 1) {
 		/*
 		/*
@@ -1167,7 +1164,6 @@ static void timer_function_netif_check_timeout (
 	void *data)
 	void *data)
 {
 {
 	struct totemudpu_instance *instance = (struct totemudpu_instance *)data;
 	struct totemudpu_instance *instance = (struct totemudpu_instance *)data;
-	int res;
 	int interface_up;
 	int interface_up;
 	int interface_num;
 	int interface_num;
 	struct totem_ip_address *bind_address;
 	struct totem_ip_address *bind_address;
@@ -1233,7 +1229,7 @@ static void timer_function_netif_check_timeout (
 	/*
 	/*
 	 * Create and bind the multicast and unicast sockets
 	 * Create and bind the multicast and unicast sockets
 	 */
 	 */
-	res = totemudpu_build_sockets (instance,
+	totemudpu_build_sockets (instance,
 		bind_address,
 		bind_address,
 		&instance->totem_interface->boundto);
 		&instance->totem_interface->boundto);
 
 

+ 1 - 3
lib/coroipcc.c

@@ -372,9 +372,7 @@ error_close_unlink:
 static void
 static void
 memory_unmap (void *addr, size_t bytes)
 memory_unmap (void *addr, size_t bytes)
 {
 {
-	int res;
-
-	res = munmap (addr, bytes);
+	(void)munmap (addr, bytes);
 }
 }
 
 
 void ipc_hdb_destructor (void *context ) {
 void ipc_hdb_destructor (void *context ) {

+ 0 - 2
lib/sam.c

@@ -837,12 +837,10 @@ static cs_error_t sam_parent_warn_signal_set (
 	int parent_fd_in,
 	int parent_fd_in,
 	int parent_fd_out)
 	int parent_fd_out)
 {
 {
-	char *user_data;
 	int warn_signal;
 	int warn_signal;
 	cs_error_t err;
 	cs_error_t err;
 
 
 	err = CS_OK;
 	err = CS_OK;
-	user_data = NULL;
 
 
 	if (sam_safe_read (parent_fd_in, &warn_signal, sizeof (warn_signal)) != sizeof (warn_signal)) {
 	if (sam_safe_read (parent_fd_in, &warn_signal, sizeof (warn_signal)) != sizeof (warn_signal)) {
 		err = CS_ERR_LIBRARY;
 		err = CS_ERR_LIBRARY;

+ 1 - 2
services/cfg.c

@@ -833,7 +833,6 @@ static void message_handler_req_lib_cfg_killnode (
 	struct res_lib_cfg_killnode res_lib_cfg_killnode;
 	struct res_lib_cfg_killnode res_lib_cfg_killnode;
 	struct req_exec_cfg_killnode req_exec_cfg_killnode;
 	struct req_exec_cfg_killnode req_exec_cfg_killnode;
 	struct iovec iovec;
 	struct iovec iovec;
-	int res;
 
 
 	ENTER();
 	ENTER();
 	req_exec_cfg_killnode.header.size =
 	req_exec_cfg_killnode.header.size =
@@ -846,7 +845,7 @@ static void message_handler_req_lib_cfg_killnode (
 	iovec.iov_base = (char *)&req_exec_cfg_killnode;
 	iovec.iov_base = (char *)&req_exec_cfg_killnode;
 	iovec.iov_len = sizeof (struct req_exec_cfg_killnode);
 	iovec.iov_len = sizeof (struct req_exec_cfg_killnode);
 
 
-	res = api->totem_mcast (&iovec, 1, TOTEM_SAFE);
+	(void)api->totem_mcast (&iovec, 1, TOTEM_SAFE);
 
 
 	res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode);
 	res_lib_cfg_killnode.header.size = sizeof(struct res_lib_cfg_killnode);
 	res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE;
 	res_lib_cfg_killnode.header.id = MESSAGE_RES_CFG_KILLNODE;

+ 0 - 2
services/evs.c

@@ -323,7 +323,6 @@ static void message_handler_req_evs_leave (void *conn, const void *msg)
 	const struct req_lib_evs_leave *req_lib_evs_leave = msg;
 	const struct req_lib_evs_leave *req_lib_evs_leave = msg;
 	struct res_lib_evs_leave res_lib_evs_leave;
 	struct res_lib_evs_leave res_lib_evs_leave;
 	cs_error_t error = CS_OK;
 	cs_error_t error = CS_OK;
-	int error_index;
 	int i, j;
 	int i, j;
 	int found;
 	int found;
 	struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
 	struct evs_pd *evs_pd = (struct evs_pd *)api->ipc_private_data_get (conn);
@@ -351,7 +350,6 @@ static void message_handler_req_evs_leave (void *conn, const void *msg)
 		}
 		}
 		if (found == 0) {
 		if (found == 0) {
 			error = CS_ERR_NOT_EXIST;
 			error = CS_ERR_NOT_EXIST;
-			error_index = i;
 			break;
 			break;
 		}
 		}
 	}
 	}

+ 0 - 2
services/votequorum.c

@@ -463,7 +463,6 @@ static void read_quorum_config(hdb_handle_t quorum_handle)
 	unsigned int value = 0;
 	unsigned int value = 0;
 	int cluster_members = 0;
 	int cluster_members = 0;
 	struct list_head *tmp;
 	struct list_head *tmp;
-	struct cluster_node *node;
 
 
 	log_printf(LOGSYS_LEVEL_INFO, "Reading configuration\n");
 	log_printf(LOGSYS_LEVEL_INFO, "Reading configuration\n");
 
 
@@ -487,7 +486,6 @@ static void read_quorum_config(hdb_handle_t quorum_handle)
 	 * two_node mode is invalid if there are more than 2 nodes in the cluster!
 	 * two_node mode is invalid if there are more than 2 nodes in the cluster!
 	 */
 	 */
 	list_iterate(tmp, &cluster_members_list) {
 	list_iterate(tmp, &cluster_members_list) {
-		node = list_entry(tmp, struct cluster_node, list);
 		cluster_members++;
 		cluster_members++;
         }
         }
 
 

+ 0 - 5
tools/corosync-fplay.c

@@ -378,7 +378,6 @@ static void logsys_rec_print (const void *record)
 	const uint32_t *buf_uint32t = record;
 	const uint32_t *buf_uint32t = record;
 	uint32_t rec_size;
 	uint32_t rec_size;
 	uint32_t rec_ident;
 	uint32_t rec_ident;
-	uint32_t level;
 	uint32_t line;
 	uint32_t line;
 	uint32_t arg_size_idx;
 	uint32_t arg_size_idx;
 	unsigned int i;
 	unsigned int i;
@@ -386,7 +385,6 @@ static void logsys_rec_print (const void *record)
 	unsigned int rec_idx = 0;
 	unsigned int rec_idx = 0;
 	uint32_t record_number;
 	uint32_t record_number;
 	unsigned int words_processed;
 	unsigned int words_processed;
-	unsigned int found;
 	const char *arguments[64];
 	const char *arguments[64];
 	int arg_count = 0;
 	int arg_count = 0;
 
 
@@ -395,8 +393,6 @@ static void logsys_rec_print (const void *record)
 	line = buf_uint32t[rec_idx+2];
 	line = buf_uint32t[rec_idx+2];
 	record_number = buf_uint32t[rec_idx+3];
 	record_number = buf_uint32t[rec_idx+3];
 
 
-	level = LOGSYS_DECODE_LEVEL(rec_ident);
-
 	printf ("rec=[%d] ", record_number);
 	printf ("rec=[%d] ", record_number);
 	arg_size_idx = rec_idx + 4;
 	arg_size_idx = rec_idx + 4;
 	words_processed = 4;
 	words_processed = 4;
@@ -408,7 +404,6 @@ static void logsys_rec_print (const void *record)
 
 
 	}
 	}
 
 
-	found = 0;
 	for (i = 0; i < printer_subsys_count; i++) {
 	for (i = 0; i < printer_subsys_count; i++) {
 		if (strcmp (arguments[0], printer_subsystems[i].subsys) == 0) {
 		if (strcmp (arguments[0], printer_subsystems[i].subsys) == 0) {
 			for (j = 0; j < printer_subsystems[i].record_printers_count; j++) {
 			for (j = 0; j < printer_subsystems[i].record_printers_count; j++) {