obmc-console: Fix readability-isolate-declaration
For example:
```
/usr/bin/clang-tidy -checks=-*, readability-isolate-declaration -export-fixes /tmp/tmpoo7fbs72/tmpo8xiwfxs.yaml -p=build /mnt/host/andrew/home/andrew/src/openbmc/obmc-console/test/test-client-escape.c
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:61:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
char *name, *value;
^~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:62:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
char *p, *line;
^~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:110:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
size_t size, len;
^~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:170:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
struct config_item *item, *next;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../console-client.c:263:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
struct console_client _client, *client;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
```
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia7829b1672ea2dfb3fa020c7c48bd8266e6a1769
diff --git a/console-server.c b/console-server.c
index 2750349..9da26b6 100644
--- a/console-server.c
+++ b/console-server.c
@@ -240,7 +240,8 @@
static void tty_change_baudrate(struct console *console)
{
struct handler *handler;
- int i, rc;
+ int i;
+ int rc;
tty_init_termios(console);
@@ -428,7 +429,8 @@
struct config *config __attribute__((unused)))
{
int dbus_poller = 0;
- int fd, r;
+ int fd;
+ int r;
if (!console) {
warnx("Couldn't get valid console");
@@ -470,10 +472,13 @@
static void handlers_init(struct console *console, struct config *config)
{
- /* NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp) */
- extern struct handler *__start_handlers, *__stop_handlers;
+ /* NOLINTBEGIN(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp) */
+ extern struct handler *__start_handlers;
+ extern struct handler *__stop_handlers;
+ /* NOLINTEND(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp) */
struct handler *handler;
- int i, rc;
+ int i;
+ int rc;
console->n_handlers = &__stop_handlers - &__start_handlers;
console->handlers = &__start_handlers;
@@ -655,7 +660,8 @@
static long get_poll_timeout(struct console *console, struct timeval *cur_time)
{
- struct timeval *earliest, interval;
+ struct timeval *earliest;
+ struct timeval interval;
struct poller *poller;
int i;
@@ -692,7 +698,8 @@
struct poller *poller;
struct pollfd *pollfd;
enum poller_ret prc;
- int i, rc;
+ int i;
+ int rc;
rc = 0;
@@ -848,7 +855,8 @@
rc = -1;
for (;;) {
- int c, idx;
+ int c;
+ int idx;
c = getopt_long(argc, argv, "c:", options, &idx);
if (c == -1) {