summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-08-14 21:12:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-08-14 21:12:31 -0700
commit63704bd63b83a524215cefd0be3f72282c4378d7 (patch)
tree82780651d1f7e3c3b386ebaa1f1d65d2284d6e31 /lib.c
parent70ee17726d2c419c049ad87098e61a73bcd14766 (diff)
downloadtxr-63704bd63b83a524215cefd0be3f72282c4378d7.tar.gz
txr-63704bd63b83a524215cefd0be3f72282c4378d7.tar.bz2
txr-63704bd63b83a524215cefd0be3f72282c4378d7.zip
seq_iter: remove pointless one-member union.
* lib.h (struct seq_iter): union ul with just one member replaced by that member itself. * lib.c (seq_iter_get_vec, seq_iter_peek_vec, seq_iter_init): refer to it->len instead of it->ul.len.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib.c b/lib.c
index 721f68a0..5a99d1b0 100644
--- a/lib.c
+++ b/lib.c
@@ -342,7 +342,7 @@ static int seq_iter_peek_list(seq_iter_t *it, val *pval)
static int seq_iter_get_vec(seq_iter_t *it, val *pval)
{
- if (it->ui.index < it->ul.len) {
+ if (it->ui.index < it->len) {
*pval = ref(it->inf.obj, num(it->ui.index++));
return 1;
}
@@ -351,7 +351,7 @@ static int seq_iter_get_vec(seq_iter_t *it, val *pval)
static int seq_iter_peek_vec(seq_iter_t *it, val *pval)
{
- if (it->ui.index < it->ul.len) {
+ if (it->ui.index < it->len) {
*pval = ref(it->inf.obj, num(it->ui.index));
return 1;
}
@@ -404,25 +404,25 @@ void seq_iter_init(val self, seq_iter_t *it, val obj)
switch (it->inf.kind) {
case SEQ_NIL:
it->ui.iter = nil;
- it->ul.len = 0;
+ it->len = 0;
it->get = seq_iter_get_nil;
it->peek = seq_iter_peek_nil;
break;
case SEQ_LISTLIKE:
it->ui.iter = it->inf.obj;
- it->ul.len = 0;
+ it->len = 0;
it->get = seq_iter_get_list;
it->peek = seq_iter_peek_list;
break;
case SEQ_VECLIKE:
it->ui.index = 0;
- it->ul.len = c_num(length(it->inf.obj));
+ it->len = c_num(length(it->inf.obj));
it->get = seq_iter_get_vec;
it->peek = seq_iter_peek_vec;
break;
case SEQ_HASHLIKE:
it->ui.iter = hash_begin(it->inf.obj);
- it->ul.len = 0;
+ it->len = 0;
it->get = seq_iter_get_hash;
it->peek = seq_iter_peek_hash;
break;