Browse Source

Fix dead assignments

Serj Kalichev 2 years ago
parent
commit
789092e1df
3 changed files with 16 additions and 16 deletions
  1. 1 3
      bin/konfd.c
  2. 14 11
      clish/shell/shell_tinyrl.c
  3. 1 2
      konf/net/net.c

+ 1 - 3
bin/konfd.c

@@ -261,11 +261,9 @@ int main(int argc, char **argv)
 					konf_buf__set_data(tbuf, (void *)1);
 					konf_buf__set_data(tbuf, (void *)1);
 				FD_SET(new, &active_fd_set);
 				FD_SET(new, &active_fd_set);
 			} else {
 			} else {
-				int nbytes;
-
 				tbuf = konf_buftree_find(bufs, i);
 				tbuf = konf_buftree_find(bufs, i);
 				/* Data arriving on an already-connected socket. */
 				/* Data arriving on an already-connected socket. */
-				if ((nbytes = konf_buf_read(tbuf)) <= 0) {
+				if (konf_buf_read(tbuf) <= 0) {
 					close(i);
 					close(i);
 					FD_CLR(i, &active_fd_set);
 					FD_CLR(i, &active_fd_set);
 					konf_buftree_remove(bufs, i);
 					konf_buftree_remove(bufs, i);

+ 14 - 11
clish/shell/shell_tinyrl.c

@@ -158,13 +158,14 @@ static bool_t clish_shell_tinyrl_key_space(tinyrl_t *this, int key)
 	const clish_command_t *cmd = NULL;
 	const clish_command_t *cmd = NULL;
 	clish_pargv_t *pargv = NULL;
 	clish_pargv_t *pargv = NULL;
 
 
-	if(tinyrl_is_empty(this)) {
-		/* ignore space at the begining of the line, don't display commands */
+	/* ignore space at the begining of the line, don't display commands */
+	if (tinyrl_is_empty(this))
 		return BOOL_TRUE;
 		return BOOL_TRUE;
-	} else if (tinyrl_is_quoting(this)) {
-		/* if we are in the middle of a quote then simply enter a space */
-		result = BOOL_TRUE;
-	} else {
+	
+	/* if we are in the middle of a quote then simply enter a space */
+	/* If it's not a quotation */
+	if (!tinyrl_is_quoting(this)) {
+
 		/* Find out if current line is legal. It can be
 		/* Find out if current line is legal. It can be
 		 * fully completed or partially completed.
 		 * fully completed or partially completed.
 		 */
 		 */
@@ -180,6 +181,7 @@ static bool_t clish_shell_tinyrl_key_space(tinyrl_t *this, int key)
 		default:
 		default:
 			break;
 			break;
 		}
 		}
+
 		/* If current line is illegal try to make auto-comletion. */
 		/* If current line is illegal try to make auto-comletion. */
 		if (!result) {
 		if (!result) {
 			/* perform word completion */
 			/* perform word completion */
@@ -192,17 +194,18 @@ static bool_t clish_shell_tinyrl_key_space(tinyrl_t *this, int key)
 			case TINYRL_COMPLETED_AMBIGUOUS:
 			case TINYRL_COMPLETED_AMBIGUOUS:
 				/* perform word completion again in case we just did case
 				/* perform word completion again in case we just did case
 				   modification the first time */
 				   modification the first time */
-				status = clish_shell_tinyrl_complete(this);
-				if (status == TINYRL_MATCH_WITH_EXTENSIONS) {
+				clish_shell_tinyrl_complete(this);
+				//status = clish_shell_tinyrl_complete(this);
+				//if (status == TINYRL_MATCH_WITH_EXTENSIONS) {
 					/* all is well with the world just enter a space */
 					/* all is well with the world just enter a space */
-					result = BOOL_TRUE;
-				}
+				//	result = BOOL_TRUE;
+				//}
 				break;
 				break;
 			case TINYRL_MATCH:
 			case TINYRL_MATCH:
 			case TINYRL_MATCH_WITH_EXTENSIONS:
 			case TINYRL_MATCH_WITH_EXTENSIONS:
 			case TINYRL_COMPLETED_MATCH:
 			case TINYRL_COMPLETED_MATCH:
 				/* all is well with the world just enter a space */
 				/* all is well with the world just enter a space */
-				result = BOOL_TRUE;
+				//result = BOOL_TRUE;
 				break;
 				break;
 			}
 			}
 		}
 		}

+ 1 - 2
konf/net/net.c

@@ -193,7 +193,6 @@ static int process_answer(konf_client_t * this, char *str, konf_buf_t *buf, konf
 int konf_client_recv_answer(konf_client_t * this, konf_buf_t **data)
 int konf_client_recv_answer(konf_client_t * this, konf_buf_t **data)
 {
 {
 	konf_buf_t *buf;
 	konf_buf_t *buf;
-	int nbytes;
 	char *str;
 	char *str;
 	int retval = 0;
 	int retval = 0;
 	int processed = 0;
 	int processed = 0;
@@ -202,7 +201,7 @@ int konf_client_recv_answer(konf_client_t * this, konf_buf_t **data)
 		return -1;
 		return -1;
 
 
 	buf = konf_buf_new(konf_client__get_sock(this));
 	buf = konf_buf_new(konf_client__get_sock(this));
-	while ((!processed) && (nbytes = konf_buf_read(buf)) > 0) {
+	while ((!processed) && konf_buf_read(buf) > 0) {
 		while ((str = konf_buf_parse(buf))) {
 		while ((str = konf_buf_parse(buf))) {
 			konf_buf_t *tmpdata = NULL;
 			konf_buf_t *tmpdata = NULL;
 			retval = process_answer(this, str, buf, &tmpdata);
 			retval = process_answer(this, str, buf, &tmpdata);