libctf: fix GNU style for do {} while

It's formatted like this:

do
  {
    ...
  }
while (...);

Not like this:

do
 {
    ...
  } while (...);

or this:

do {
  ...
} while (...);

We used both in various places in libctf.  Fixing it necessitated some
light reindentation.

libctf/ChangeLog
2021-03-18  Nick Alcock  <nick.alcock@oracle.com>

	* ctf-archive.c (ctf_archive_next): GNU style fix for do {} while.
	* ctf-dedup.c (ctf_dedup_rhash_type): Likewise.
	(ctf_dedup_rwalk_one_output_mapping): Likewise.
	* ctf-dump.c (ctf_dump_format_type): Likewise.
	* ctf-lookup.c (ctf_symbol_next): Likewise.
	* swap.h (swap_thing): Likewise.
This commit is contained in:
Nick Alcock 2021-03-18 12:37:52 +00:00
parent b9a964318a
commit eefe721ead
6 changed files with 63 additions and 46 deletions

View file

@ -1,3 +1,12 @@
2021-03-18 Nick Alcock <nick.alcock@oracle.com>
* ctf-archive.c (ctf_archive_next): GNU style fix for do {} while.
* ctf-dedup.c (ctf_dedup_rhash_type): Likewise.
(ctf_dedup_rwalk_one_output_mapping): Likewise.
* ctf-dump.c (ctf_dump_format_type): Likewise.
* ctf-lookup.c (ctf_symbol_next): Likewise.
* swap.h (swap_thing): Likewise.
2021-03-18 Nick Alcock <nick.alcock@oracle.com>
* ctf-serialize.c: General reshuffling, and...

View file

@ -1156,7 +1156,8 @@ ctf_archive_next (const ctf_archive_t *wrapper, ctf_next_t **it, const char **na
name_ = &nametbl[le64toh (modent[i->ctn_n].name_offset)];
i->ctn_n++;
} while (skip_parent && strcmp (name_, _CTF_SECTION) == 0);
}
while (skip_parent && strcmp (name_, _CTF_SECTION) == 0);
if (name)
*name = name_;

View file

@ -589,7 +589,8 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
goto oom; \
if (ctf_dynset_cinsert (citers, hval) < 0) \
goto oom; \
} while (0)
} \
while (0)
/* If this is a named struct or union or a forward to one, and this is a child
traversal, treat this type as if it were a forward -- do not recurse to
@ -2029,7 +2030,8 @@ ctf_dedup_rwalk_one_output_mapping (ctf_dict_t *output,
times, which is worse. */
#define CTF_TYPE_WALK(type, errlabel, errmsg) \
do { \
do \
{ \
void *type_id; \
const char *hashval; \
int cited_type_input_num = input_num; \
@ -2064,7 +2066,8 @@ ctf_dedup_rwalk_one_output_mapping (ctf_dict_t *output,
whaterr = errmsg; \
goto errlabel; \
} \
} while (0)
} \
while (0)
switch (ctf_type_kind_unsliced (fp, type))
{

View file

@ -220,7 +220,8 @@ ctf_dump_format_type (ctf_dict_t *fp, ctf_id_t id, int flag)
new_id = ctf_type_reference (fp, id);
if (new_id != CTF_ERR)
str = str_append (str, " -> ");
} while (new_id != CTF_ERR);
}
while (new_id != CTF_ERR);
if (ctf_errno (fp) != ECTF_NOTREF)
{

View file

@ -723,7 +723,8 @@ ctf_symbol_next (ctf_dict_t *fp, ctf_next_t **it, const char **name,
*name = ctf_strptr (fp, idx[i->ctn_n]);
sym = tab[i->ctn_n++];
} while (sym == -1u || sym == 0);
}
while (sym == -1u || sym == 0);
}
else
{

View file

@ -73,7 +73,8 @@ bswap_64 (uint64_t v)
/* Swap the endianness of something. */
#define swap_thing(x) \
do { \
do \
{ \
_Static_assert (sizeof (x) == 1 || (sizeof (x) % 2 == 0 \
&& sizeof (x) <= 8), \
"Invalid size, update endianness code"); \
@ -84,7 +85,8 @@ bswap_64 (uint64_t v)
case 1: /* Nothing needs doing */ \
break; \
} \
} while (0);
} \
while (0);
#endif /* !defined(_CTF_SWAP_H) */