[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] fix compiler warning suggest parentheses around assignment used
From: |
Rudi Heitbaum |
Subject: |
[PATCH] fix compiler warning suggest parentheses around assignment used as truth value |
Date: |
Sat, 20 Jul 2024 06:19:26 +0000 |
when compiled with -Wparentheses
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
bind.c | 4 ++--
complete.c | 6 +++---
histexpand.c | 2 +-
histsearch.c | 2 +-
input.c | 2 +-
misc.c | 4 ++--
text.c | 2 +-
tilde.c | 2 +-
8 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/bind.c b/bind.c
index af3d70e..3448927 100644
--- a/bind.c
+++ b/bind.c
@@ -1564,7 +1564,7 @@ _rl_skip_to_delim (char *string, int start, int delim)
{
int i, c, passc;
- for (i = start,passc = 0; c = string[i]; i++)
+ for (i = start,passc = 0; (c = string[i]); i++)
{
if (passc)
{
@@ -2806,7 +2806,7 @@ rl_function_dumper (int print_readably)
fprintf (rl_outstream, "\n");
- for (i = 0; name = names[i]; i++)
+ for (i = 0; (name = names[i]); i++)
rl_print_keybinding (name, _rl_keymap, print_readably);
xfree (names);
diff --git a/complete.c b/complete.c
index f564a47..c62a0c6 100644
--- a/complete.c
+++ b/complete.c
@@ -1184,7 +1184,7 @@ _rl_find_completion_word (int *fp, int *dp)
/* We didn't find an unclosed quoted substring upon which to do
completion, so use the word break characters to find the
substring on which to complete. */
- while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
+ while ((rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY)))
{
scan = rl_line_buffer[rl_point];
@@ -2293,7 +2293,7 @@ rl_completion_matches (const char *text,
rl_compentry_func_t *entry_function)
match_list = (char **)xmalloc ((match_list_size + 1) * sizeof (char *));
match_list[1] = (char *)NULL;
- while (string = (*entry_function) (text, matches))
+ while ((string = (*entry_function) (text, matches)))
{
if (RL_SIG_RECEIVED ())
{
@@ -2362,7 +2362,7 @@ rl_username_completion_function (const char *text, int
state)
setpwent ();
}
- while (entry = getpwent ())
+ while ((entry = getpwent ()))
{
/* Null usernames should result in all users as possible completions. */
if (namelen == 0 || (STREQN (username, entry->pw_name, namelen)))
diff --git a/histexpand.c b/histexpand.c
index 8a28cbd..72d3994 100644
--- a/histexpand.c
+++ b/histexpand.c
@@ -210,7 +210,7 @@ get_history_event (const char *string, int *caller_index,
int delimiting_quote)
}
/* Only a closing `?' or a newline delimit a substring search string. */
- for (local_index = i; c = string[i]; i++)
+ for (local_index = i; (c = string[i]); i++)
{
#if defined (HANDLE_MULTIBYTE)
if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
diff --git a/histsearch.c b/histsearch.c
index b43ead1..e01bbfd 100644
--- a/histsearch.c
+++ b/histsearch.c
@@ -253,7 +253,7 @@ _hs_history_patsearch (const char *string, int direction,
int flags)
ret = len - 1;
/* fnmatch is required to reject a pattern that ends with an unescaped
backslash */
- if (unescaped_backslash = (string[ret] == '\\'))
+ if ((unescaped_backslash = (string[ret] == '\\')))
{
while (ret > 0 && string[--ret] == '\\')
unescaped_backslash = 1 - unescaped_backslash;
diff --git a/input.c b/input.c
index 9807453..a9817d8 100644
--- a/input.c
+++ b/input.c
@@ -775,7 +775,7 @@ rl_read_key (void)
else
{
/* If input is coming from a macro, then use that. */
- if (c = _rl_next_macro_key ())
+ if ((c = _rl_next_macro_key ()))
return ((unsigned char)c);
/* If the user has an event function, then call it periodically. */
diff --git a/misc.c b/misc.c
index 96c82b5..c53d1e6 100644
--- a/misc.c
+++ b/misc.c
@@ -481,7 +481,7 @@ _rl_revert_previous_lines (void)
entry = (hpos == history_length) ? previous_history () : current_history ();
while (entry)
{
- if (ul = (UNDO_LIST *)entry->data)
+ if ((ul = (UNDO_LIST *)entry->data))
{
if (ul == saved_undo_list)
saved_undo_list = 0;
@@ -541,7 +541,7 @@ rl_clear_history (void)
for (i = 0; i < history_length; i++)
{
hent = hlist[i];
- if (ul = (UNDO_LIST *)hent->data)
+ if ((ul = (UNDO_LIST *)hent->data))
{
if (ul == saved_undo_list)
saved_undo_list = 0;
diff --git a/text.c b/text.c
index c5281ef..c9a6d3d 100644
--- a/text.c
+++ b/text.c
@@ -2356,7 +2356,7 @@ rl_execute_named_command (int count, int key)
command = _rl_read_command_name ();
if (command == 0 || *command == '\0')
return 1;
- if (func = rl_named_function (command))
+ if ((func = rl_named_function (command)))
{
int prev, ostate;
diff --git a/tilde.c b/tilde.c
index 734b208..941142d 100644
--- a/tilde.c
+++ b/tilde.c
@@ -185,7 +185,7 @@ tilde_expand (const char *string)
size_t result_size, result_index;
result_index = result_size = 0;
- if (result = strchr (string, '~'))
+ if ((result = strchr (string, '~')))
result = (char *)xmalloc (result_size = (strlen (string) + 16));
else
result = (char *)xmalloc (result_size = (strlen (string) + 1));
--
2.43.0
- [PATCH] fix compiler warning suggest parentheses around assignment used as truth value,
Rudi Heitbaum <=