diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-22 12:38:30 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-10-22 12:38:30 -0700 |
commit | 4265e8b5e6d363b5bef1fb217012eb4aee65a0cd (patch) | |
tree | 8b0cc2bf397534ea57ec4808fa2b10502cf222f2 | |
parent | fd33460f430cf043e9610847974b9b3892d57595 (diff) |
Variable scope reductions as suggested by cppcheck
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xlsatoms.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -73,14 +73,13 @@ main(int argc, char *argv[]) { char *displayname = NULL; const char *format = "%lu\t%s"; - int i, doit; int didit = 0; xcb_connection_t *c = NULL; ProgramName = argv[0]; - for (doit = 0; doit < 2; doit++) { /* pre-parse to get display */ - for (i = 1; i < argc; i++) { + for (int doit = 0; doit < 2; doit++) { /* pre-parse to get display */ + for (int i = 1; i < argc; i++) { char *arg = argv[i]; if (arg[0] == '-') { @@ -273,7 +272,6 @@ list_atoms(xcb_connection_t *c, const char *format, int mask, xcb_atom_t low, xc { xcb_get_atom_name_cookie_t cookie_jar[ATOMS_PER_BATCH]; int done = 0; - long count; if ((mask & RangeLow) == 0) low = 1; @@ -281,7 +279,8 @@ list_atoms(xcb_connection_t *c, const char *format, int mask, xcb_atom_t low, xc high = UINT32_MAX; while (!done) { - count = high - low < ATOMS_PER_BATCH - 1 ? high - low + 1 : ATOMS_PER_BATCH; + long count = (high - low < ATOMS_PER_BATCH - 1) ? + (high - low + 1) : ATOMS_PER_BATCH; done = say_batch(c, format, cookie_jar, low, count, (mask & RangeHigh) == 0); if (high - low < UINT32_MAX && low == high - count + 1) { done = 1; |