diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2019-07-25 19:59:32 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2019-10-03 17:04:55 +0100 |
commit | 5ae6af75b50bb4137d286a14e2fd1e74cfa089f4 (patch) | |
tree | a5c15eef747e10458d56fd78816f29bbf9d5049c /libctf | |
parent | 1820745a0af0768d9dcd515b98ad038ff9f15f23 (diff) | |
download | gdb-5ae6af75b50bb4137d286a14e2fd1e74cfa089f4.zip gdb-5ae6af75b50bb4137d286a14e2fd1e74cfa089f4.tar.gz gdb-5ae6af75b50bb4137d286a14e2fd1e74cfa089f4.tar.bz2 |
libctf: eschew C99 for loop initial declarations
We shouldn't use these, since binutils doesn't require a C99-capable
compiler yet.
New in v3.
v5: fix tabdamage.
libctf/
* ctf-open.c (flip_lbls): Eschew for-loop initial declarations.
(flip_objts): Likewise.
(flip_vars): Likewise.
(flip_types): Likewise.
Diffstat (limited to 'libctf')
-rw-r--r-- | libctf/ChangeLog | 7 | ||||
-rw-r--r-- | libctf/ctf-open.c | 21 |
2 files changed, 21 insertions, 7 deletions
diff --git a/libctf/ChangeLog b/libctf/ChangeLog index 08a2e3a..83b3167 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,5 +1,12 @@ 2019-07-30 Nick Alcock <nick.alcock@oracle.com> + * ctf-open.c (flip_lbls): Eschew for-loop initial declarations. + (flip_objts): Likewise. + (flip_vars): Likewise. + (flip_types): Likewise. + +2019-07-30 Nick Alcock <nick.alcock@oracle.com> + * ctf-hash.c (ctf_hashtab_insert): Pass in the key and value freeing functions: if set, free the key and value if the slot already exists. Always reassign the key. diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c index 2e1913b..9dcd274 100644 --- a/libctf/ctf-open.c +++ b/libctf/ctf-open.c @@ -986,8 +986,9 @@ static void flip_lbls (void *start, size_t len) { ctf_lblent_t *lbl = start; + ssize_t i; - for (ssize_t i = len / sizeof (struct ctf_lblent); i > 0; lbl++, i--) + for (i = len / sizeof (struct ctf_lblent); i > 0; lbl++, i--) { swap_thing (lbl->ctl_label); swap_thing (lbl->ctl_type); @@ -1003,8 +1004,9 @@ static void flip_objts (void *start, size_t len) { uint32_t *obj = start; + ssize_t i; - for (ssize_t i = len / sizeof (uint32_t); i > 0; obj++, i--) + for (i = len / sizeof (uint32_t); i > 0; obj++, i--) swap_thing (*obj); } @@ -1014,8 +1016,9 @@ static void flip_vars (void *start, size_t len) { ctf_varent_t *var = start; + ssize_t i; - for (ssize_t i = len / sizeof (struct ctf_varent); i > 0; var++, i--) + for (i = len / sizeof (struct ctf_varent); i > 0; var++, i--) { swap_thing (var->ctv_name); swap_thing (var->ctv_type); @@ -1080,8 +1083,9 @@ flip_types (void *start, size_t len) /* This type has a bunch of uint32_ts. */ uint32_t *item = (uint32_t *) t; + ssize_t i; - for (ssize_t i = vlen; i > 0; item++, i--) + for (i = vlen; i > 0; item++, i--) swap_thing (*item); break; } @@ -1125,7 +1129,8 @@ flip_types (void *start, size_t len) if (_libctf_unlikely_ (size >= CTF_LSTRUCT_THRESH)) { ctf_lmember_t *lm = (ctf_lmember_t *) t; - for (ssize_t i = vlen; i > 0; i--, lm++) + ssize_t i; + for (i = vlen; i > 0; i--, lm++) { swap_thing (lm->ctlm_name); swap_thing (lm->ctlm_offsethi); @@ -1136,7 +1141,8 @@ flip_types (void *start, size_t len) else { ctf_member_t *m = (ctf_member_t *) t; - for (ssize_t i = vlen; i > 0; i--, m++) + ssize_t i; + for (i = vlen; i > 0; i--, m++) { swap_thing (m->ctm_name); swap_thing (m->ctm_offset); @@ -1151,8 +1157,9 @@ flip_types (void *start, size_t len) /* This has an array of ctf_enum_t. */ ctf_enum_t *item = (ctf_enum_t *) t; + ssize_t i; - for (ssize_t i = vlen; i > 0; item++, i--) + for (i = vlen; i > 0; item++, i--) { swap_thing (item->cte_name); swap_thing (item->cte_value); |