mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
Rename setstate_t to set_iter_t.
After all, it is an iterator :).
This commit is contained in:
parent
d3d88290b5
commit
2385cf65c2
3 changed files with 34 additions and 34 deletions
|
@ -42,16 +42,16 @@ typedef struct set_s {
|
|||
unsigned defmap[8];
|
||||
} set_t;
|
||||
|
||||
typedef struct setstate_s {
|
||||
struct setstate_s *next; //< private. for ALLOC
|
||||
typedef struct set_iter_s {
|
||||
struct set_iter_s *next; //< private. for ALLOC
|
||||
const set_t *set;
|
||||
/** The result of set_first() or set_next(). set_next() will start at the
|
||||
following member.
|
||||
*/
|
||||
unsigned member;
|
||||
} setstate_t;
|
||||
} set_iter_t;
|
||||
|
||||
void set_delstate (setstate_t *setstate);
|
||||
void set_del_iter (set_iter_t *set_iter);
|
||||
set_t *set_new (void);
|
||||
void set_delete (set_t *set);
|
||||
void set_add (set_t *set, unsigned x);
|
||||
|
@ -70,8 +70,8 @@ int set_is_equivalent (const set_t *s1, const set_t *s2);
|
|||
int set_is_subset (const set_t *set, const set_t *sub);
|
||||
int set_is_member (const set_t *set, unsigned x);
|
||||
unsigned set_size (const set_t *set);
|
||||
setstate_t *set_first (const set_t *set);
|
||||
setstate_t *set_next (setstate_t *setstate);
|
||||
set_iter_t *set_first (const set_t *set);
|
||||
set_iter_t *set_next (set_iter_t *set_iter);
|
||||
const char *set_as_string (const set_t *set);
|
||||
|
||||
//@}
|
||||
|
|
|
@ -314,9 +314,9 @@ make_loop (flownode_t **node_list, unsigned num_nodes, unsigned n, unsigned d)
|
|||
set_add (loop->nodes, d);
|
||||
insert_loop_node (loop, n, stack);
|
||||
while (!set_is_empty (stack)) {
|
||||
setstate_t *ss = set_first (stack);
|
||||
set_iter_t *ss = set_first (stack);
|
||||
unsigned m = ss->member;
|
||||
set_delstate (ss);
|
||||
set_del_iter (ss);
|
||||
set_remove (stack, m);
|
||||
node = node_list[m];
|
||||
for (pred = node->predecessors;
|
||||
|
@ -404,7 +404,7 @@ static set_t *
|
|||
select_nodes (flownode_t *graph, set_t *G, unsigned n)
|
||||
{
|
||||
set_t *I;
|
||||
setstate_t *m;
|
||||
set_iter_t *m;
|
||||
|
||||
I = set_new ();
|
||||
set_add (I, n);
|
||||
|
@ -427,7 +427,7 @@ flow_reduce (flownode_t *graph)
|
|||
int k;
|
||||
flownode_t **node_list = 0;
|
||||
flownode_t *node;
|
||||
setstate_t *m;
|
||||
set_iter_t *m;
|
||||
|
||||
if (graph->num_siblings < 2)
|
||||
return 0;
|
||||
|
|
|
@ -48,27 +48,27 @@
|
|||
|
||||
#define BITS (sizeof (unsigned) * 8)
|
||||
|
||||
setstate_t *free_setstates;
|
||||
set_iter_t *free_set_iters;
|
||||
|
||||
static setstate_t *
|
||||
new_setstate (void)
|
||||
static set_iter_t *
|
||||
new_setiter (void)
|
||||
{
|
||||
setstate_t *setstate;
|
||||
ALLOC (16, setstate_t, setstates, setstate);
|
||||
return setstate;
|
||||
set_iter_t *set_iter;
|
||||
ALLOC (16, set_iter_t, set_iters, set_iter);
|
||||
return set_iter;
|
||||
}
|
||||
|
||||
static void
|
||||
delete_setstate (setstate_t *setstate)
|
||||
delete_setiter (set_iter_t *set_iter)
|
||||
{
|
||||
setstate->next = free_setstates;
|
||||
free_setstates = setstate;
|
||||
set_iter->next = free_set_iters;
|
||||
free_set_iters = set_iter;
|
||||
}
|
||||
|
||||
void
|
||||
set_delstate (setstate_t *setstate)
|
||||
set_del_iter (set_iter_t *set_iter)
|
||||
{
|
||||
delete_setstate (setstate);
|
||||
delete_setiter (set_iter);
|
||||
}
|
||||
|
||||
set_t *
|
||||
|
@ -281,35 +281,35 @@ set_size (const set_t *set)
|
|||
return count;
|
||||
}
|
||||
|
||||
setstate_t *
|
||||
set_iter_t *
|
||||
set_first (const set_t *set)
|
||||
{
|
||||
unsigned x;
|
||||
setstate_t *setstate;
|
||||
set_iter_t *set_iter;
|
||||
|
||||
for (x = 0; x < set->size; x++) {
|
||||
if (set_is_member (set, x)) {
|
||||
setstate = new_setstate ();
|
||||
setstate->set = set;
|
||||
setstate->member = x;
|
||||
return setstate;
|
||||
set_iter = new_setiter ();
|
||||
set_iter->set = set;
|
||||
set_iter->member = x;
|
||||
return set_iter;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
setstate_t *
|
||||
set_next (setstate_t *setstate)
|
||||
set_iter_t *
|
||||
set_next (set_iter_t *set_iter)
|
||||
{
|
||||
unsigned x;
|
||||
|
||||
for (x = setstate->member + 1; x < setstate->set->size; x++) {
|
||||
if (set_is_member (setstate->set, x)) {
|
||||
setstate->member = x;
|
||||
return setstate;
|
||||
for (x = set_iter->member + 1; x < set_iter->set->size; x++) {
|
||||
if (set_is_member (set_iter->set, x)) {
|
||||
set_iter->member = x;
|
||||
return set_iter;
|
||||
}
|
||||
}
|
||||
delete_setstate (setstate);
|
||||
delete_setiter (set_iter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue