* [PATCH 1/4] qobject: open brace '{' following struct go on the same line
2020-12-28 7:11 [PATCH 0/4] Fix some style problems in qobject Zhang Han
@ 2020-12-28 7:11 ` Zhang Han
2020-12-28 11:12 ` Philippe Mathieu-Daudé
2020-12-28 7:11 ` [PATCH 2/4] qobject: code indent should never use tabs Zhang Han
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Zhang Han @ 2020-12-28 7:11 UTC (permalink / raw)
To: armbru; +Cc: alex.chen, hunongda, qemu-trivial, qemu-devel,
zhang.zhanghailiang
Put open brace '{' on the same line of struct.
Signed-off-by: Zhang Han <zhanghan64@huawei.com>
---
qobject/json-parser.c | 3 +--
qobject/qjson.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/qobject/json-parser.c b/qobject/json-parser.c
index c0f521b56b..18b87a42f3 100644
--- a/qobject/json-parser.c
+++ b/qobject/json-parser.c
@@ -31,8 +31,7 @@ struct JSONToken {
char str[];
};
-typedef struct JSONParserContext
-{
+typedef struct JSONParserContext {
Error *err;
JSONToken *current;
GQueue *buf;
diff --git a/qobject/qjson.c b/qobject/qjson.c
index f1f2c69704..f5623081e3 100644
--- a/qobject/qjson.c
+++ b/qobject/qjson.c
@@ -22,8 +22,7 @@
#include "qapi/qmp/qstring.h"
#include "qemu/unicode.h"
-typedef struct JSONParsingState
-{
+typedef struct JSONParsingState {
JSONMessageParser parser;
QObject *result;
Error *err;
--
2.29.1.59.gf9b6481aed
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] qobject: code indent should never use tabs
2020-12-28 7:11 [PATCH 0/4] Fix some style problems in qobject Zhang Han
2020-12-28 7:11 ` [PATCH 1/4] qobject: open brace '{' following struct go on the same line Zhang Han
@ 2020-12-28 7:11 ` Zhang Han
2020-12-28 7:11 ` [PATCH 3/4] qobject: spaces required around that operators Zhang Han
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: Zhang Han @ 2020-12-28 7:11 UTC (permalink / raw)
To: armbru; +Cc: alex.chen, hunongda, qemu-trivial, qemu-devel,
zhang.zhanghailiang
Transfer tabs to spaces.
Signed-off-by: Zhang Han <zhanghan64@huawei.com>
---
qobject/qdict.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 1079bd3f6f..2c07b3c87f 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -38,8 +38,8 @@ QDict *qdict_new(void)
*/
static unsigned int tdb_hash(const char *name)
{
- unsigned value; /* Used to compute the hash value. */
- unsigned i; /* Used to cycle through random values. */
+ unsigned value; /* Used to compute the hash value. */
+ 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++)
--
2.29.1.59.gf9b6481aed
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] qobject: spaces required around that operators
2020-12-28 7:11 [PATCH 0/4] Fix some style problems in qobject Zhang Han
2020-12-28 7:11 ` [PATCH 1/4] qobject: open brace '{' following struct go on the same line Zhang Han
2020-12-28 7:11 ` [PATCH 2/4] qobject: code indent should never use tabs Zhang Han
@ 2020-12-28 7:11 ` Zhang Han
2020-12-28 7:11 ` [PATCH 4/4] qobject: braces {} are necessary for all arms of this statement Zhang Han
2020-12-28 7:45 ` [PATCH 0/4] Fix some style problems in qobject no-reply
4 siblings, 0 replies; 11+ messages in thread
From: Zhang Han @ 2020-12-28 7:11 UTC (permalink / raw)
To: armbru; +Cc: alex.chen, hunongda, qemu-trivial, qemu-devel,
zhang.zhanghailiang
Add spaces around operators.
Signed-off-by: Zhang Han <zhanghan64@huawei.com>
---
qobject/qdict.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qobject/qdict.c b/qobject/qdict.c
index 2c07b3c87f..05ec950e05 100644
--- a/qobject/qdict.c
+++ b/qobject/qdict.c
@@ -42,8 +42,8 @@ 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++)
- value = (value + (((const unsigned char *)name)[i] << (i*5 % 24)));
+ for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++)
+ value = (value + (((const unsigned char *)name)[i] << (i * 5 % 24)));
return (1103515243 * value + 12345);
}
--
2.29.1.59.gf9b6481aed
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] qobject: braces {} are necessary for all arms of this statement
2020-12-28 7:11 [PATCH 0/4] Fix some style problems in qobject Zhang Han
` (2 preceding siblings ...)
2020-12-28 7:11 ` [PATCH 3/4] qobject: spaces required around that operators Zhang Han
@ 2020-12-28 7:11 ` Zhang Han
2020-12-28 11:13 ` Philippe Mathieu-Daudé
2020-12-28 7:45 ` [PATCH 0/4] Fix some style problems in qobject no-reply
4 siblings, 1 reply; 11+ messages in thread
From: Zhang Han @ 2020-12-28 7:11 UTC (permalink / raw)
To: armbru; +Cc: alex.chen, hunongda, qemu-trivial, qemu-devel,
zhang.zhanghailiang
Add braces {} for arms of if/for statement
Signed-off-by: Zhang Han <zhanghan64@huawei.com>
---
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, &qdict->table[bucket], next)
- if (!strcmp(entry->key, key))
+ if (!strcmp(entry->key, key)) {
return entry;
+ }
return NULL;
}
--
2.29.1.59.gf9b6481aed
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/4] Fix some style problems in qobject
2020-12-28 7:11 [PATCH 0/4] Fix some style problems in qobject Zhang Han
` (3 preceding siblings ...)
2020-12-28 7:11 ` [PATCH 4/4] qobject: braces {} are necessary for all arms of this statement Zhang Han
@ 2020-12-28 7:45 ` no-reply
4 siblings, 0 replies; 11+ messages in thread
From: no-reply @ 2020-12-28 7:45 UTC (permalink / raw)
To: zhanghan64
Cc: hunongda, zhang.zhanghailiang, qemu-trivial, armbru, qemu-devel,
alex.chen
Patchew URL: https://patchew.org/QEMU/20201228071129.24563-1-zhanghan64@huawei.com/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20201228071129.24563-1-zhanghan64@huawei.com
Subject: [PATCH 0/4] Fix some style problems in qobject
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
- [tag update] patchew/20201219104229.1964-1-mark.cave-ayland@ilande.co.uk -> patchew/20201219104229.1964-1-mark.cave-ayland@ilande.co.uk
- [tag update] patchew/20201226103347.868-1-gaojinhao@huawei.com -> patchew/20201226103347.868-1-gaojinhao@huawei.com
* [new tag] patchew/20201228071129.24563-1-zhanghan64@huawei.com -> patchew/20201228071129.24563-1-zhanghan64@huawei.com
Switched to a new branch 'test'
1caa0fd qobject: braces {} are necessary for all arms of this statement
b0ca07e qobject: spaces required around that operators
0adae60 qobject: code indent should never use tabs
4eea991 qobject: open brace '{' following struct go on the same line
=== OUTPUT BEGIN ===
1/4 Checking commit 4eea9919361d (qobject: open brace '{' following struct go on the same line)
2/4 Checking commit 0adae6079b21 (qobject: code indent should never use tabs)
3/4 Checking commit b0ca07e6cac6 (qobject: spaces required around that operators)
ERROR: braces {} are necessary for all arms of this statement
#22: FILE: qobject/qdict.c:45:
+ for (value = 0x238F13AF * strlen(name), i = 0; name[i]; i++)
[...]
total: 1 errors, 0 warnings, 10 lines checked
Patch 3/4 has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/4 Checking commit 1caa0fdbcda9 (qobject: braces {} are necessary for all arms of this statement)
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20201228071129.24563-1-zhanghan64@huawei.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 11+ messages in thread