style: eliminate useless indirection

* src/relation.h, src/relation.c (relation_digraph): Don't take the
biteetv as a pointer, it is already a pointer (as it's an array).
This commit is contained in:
Akim Demaille
2019-02-24 20:54:37 +01:00
parent ec8142391a
commit d04962f788
4 changed files with 12 additions and 10 deletions

View File

@@ -244,7 +244,7 @@ ielr_compute_follow_kernel_items (bitset ritem_sees_lookahead_set,
&& bitset_test (ritem_sees_lookahead_set, items[j])) && bitset_test (ritem_sees_lookahead_set, items[j]))
bitset_set ((*follow_kernel_itemsp)[i], j); bitset_set ((*follow_kernel_itemsp)[i], j);
} }
relation_digraph (internal_follow_edges, ngotos, follow_kernel_itemsp); relation_digraph (internal_follow_edges, ngotos, *follow_kernel_itemsp);
if (trace_flag & trace_ielr) if (trace_flag & trace_ielr)
{ {
@@ -300,7 +300,7 @@ ielr_compute_always_follows (goto_number ***edgesp,
} }
free (edge_array); free (edge_array);
} }
relation_digraph (*edgesp, ngotos, always_followsp); relation_digraph (*edgesp, ngotos, *always_followsp);
if (trace_flag & trace_ielr) if (trace_flag & trace_ielr)
{ {

View File

@@ -193,7 +193,7 @@ initialize_goto_follows (void)
} }
} }
relation_digraph (reads, ngotos, &goto_follows); relation_digraph (reads, ngotos, goto_follows);
for (goto_number i = 0; i < ngotos; ++i) for (goto_number i = 0; i < ngotos; ++i)
free (reads[i]); free (reads[i]);
@@ -312,7 +312,7 @@ follows_print (FILE* out)
static void static void
compute_follows (void) compute_follows (void)
{ {
relation_digraph (includes, ngotos, &goto_follows); relation_digraph (includes, ngotos, goto_follows);
if (trace_flag & trace_sets) if (trace_flag & trace_sets)
follows_print (stderr); follows_print (stderr);
for (goto_number i = 0; i < ngotos; ++i) for (goto_number i = 0; i < ngotos; ++i)

View File

@@ -99,7 +99,7 @@ traverse (relation_node i)
void void
relation_digraph (relation r, relation_node size, bitsetv *function) relation_digraph (relation r, relation_node size, bitsetv function)
{ {
infinity = size + 2; infinity = size + 2;
indexes = xcalloc (size + 1, sizeof *indexes); indexes = xcalloc (size + 1, sizeof *indexes);
@@ -107,7 +107,7 @@ relation_digraph (relation r, relation_node size, bitsetv *function)
top = 0; top = 0;
R = r; R = r;
F = *function; F = function;
for (relation_node i = 0; i < size; i++) for (relation_node i = 0; i < size; i++)
if (indexes[i] == 0 && R[i]) if (indexes[i] == 0 && R[i])
@@ -116,7 +116,7 @@ relation_digraph (relation r, relation_node size, bitsetv *function)
free (indexes); free (indexes);
free (vertices); free (vertices);
*function = F; function = F;
} }

View File

@@ -42,9 +42,11 @@ void relation_print (relation r, size_t size,
/* Compute the transitive closure of the FUNCTION on the relation R /* Compute the transitive closure of the FUNCTION on the relation R
with SIZE vertices. with SIZE vertices.
If R (NODE-1, NODE-2) then on exit FUNCTION[NODE - 1] was extended If R (NODE1, NODE2) then on exit FUNCTION[NODE1] was extended
(unioned) with FUNCTION[NODE - 2]. */ (unioned) with FUNCTION[NODE2].
void relation_digraph (relation r, relation_node size, bitsetv *function);
FUNCTION is in-out, R is read only. */
void relation_digraph (const relation r, relation_node size, bitsetv function);
/* Destructively transpose *R_ARG, of size SIZE. */ /* Destructively transpose *R_ARG, of size SIZE. */
void relation_transpose (relation *R_arg, relation_node size); void relation_transpose (relation *R_arg, relation_node size);