Re: [PATCH 4/4] qobject: braces {} are necessary for all arms of this statement

2020-12-28 Thread Philippe Mathieu-Daudé
On 12/28/20 8:11 AM, Zhang Han wrote:
> Add braces {} for arms of if/for statement
> 
> Signed-off-by: Zhang Han 
> ---
>  qobject/qdict.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé 




[PATCH 4/4] qobject: braces {} are necessary for all arms of this statement

2020-12-27 Thread Zhang Han
Add braces {} for arms of if/for statement

Signed-off-by: Zhang Han 
---
 qobject/qdict.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/qobject/qdict.c b/qobject/qdict.c
index 05ec950e05..0a49b787ab 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -42,8 +42,9 @@ static unsigned int tdb_hash(const char *name)
 unsigned   i;  /* Used to cycle through random values. */
 
 /* Set the initial value from the key size. */
-for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++)
+for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++) {
 value = (value + (((const unsigned char *)name)[i] << (i * 5 % 24)));
+}
 
 return (1103515243 * value + 12345);
 }
@@ -92,8 +93,9 @@ static QDictEntry *qdict_find(const QDict *qdict,
 QDictEntry *entry;
 
 QLIST_FOREACH(entry, >table[bucket], next)
-if (!strcmp(entry->key, key))
+if (!strcmp(entry->key, key)) {
 return entry;
+}
 
 return NULL;
 }
-- 
2.29.1.59.gf9b6481aed