Skip to content

Commit

Permalink
Change some inconsistent naming
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdrake committed Jun 17, 2015
1 parent 8bc7b27 commit 372cf63
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
16 changes: 8 additions & 8 deletions extension/boolexpr/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


struct BX_Array *
_bx_array_from(size_t length, struct BoolExpr **items)
_bx_array_from(size_t length, struct BoolExpr **exprs)
{
struct BX_Array *array;

Expand All @@ -20,7 +20,7 @@ _bx_array_from(size_t length, struct BoolExpr **items)
return NULL; // LCOV_EXCL_LINE

array->length = length;
array->items = items;
array->items = exprs;

for (size_t i = 0; i < length; ++i)
BX_IncRef(array->items[i]);
Expand All @@ -30,18 +30,18 @@ _bx_array_from(size_t length, struct BoolExpr **items)


struct BX_Array *
BX_Array_New(size_t length, struct BoolExpr **items)
BX_Array_New(size_t length, struct BoolExpr **exprs)
{
struct BoolExpr **items_copy;
struct BoolExpr **exprs_copy;

items_copy = malloc(length * sizeof(struct BoolExpr *));
if (items_copy == NULL)
exprs_copy = malloc(length * sizeof(struct BoolExpr *));
if (exprs_copy == NULL)
return NULL; // LCOV_EXCL_LINE

for (size_t i = 0; i < length; ++i)
items_copy[i] = items[i];
exprs_copy[i] = exprs[i];

return _bx_array_from(length, items_copy);
return _bx_array_from(length, exprs_copy);
}


Expand Down
10 changes: 5 additions & 5 deletions extension/boolexpr/binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ _commutative_binify(struct BoolExpr *op)
size_t mid = op->data.xs->length / 2;
size_t n0 = mid;
size_t n1 = op->data.xs->length - mid;
struct BoolExpr **items0 = op->data.xs->items;
struct BoolExpr **items1 = op->data.xs->items + mid;
struct BoolExpr **left = op->data.xs->items;
struct BoolExpr **right = op->data.xs->items + mid;
struct BoolExpr *xs[2];
struct BoolExpr *temp;
struct BoolExpr *y;

if (n0 == 1) {
xs[0] = BX_IncRef(items0[0]);
xs[0] = BX_IncRef(left[0]);
}
else {
CHECK_NULL(temp, _bx_op_new(op->kind, n0, items0));
CHECK_NULL(temp, _bx_op_new(op->kind, n0, left));
CHECK_NULL_1(xs[0], _commutative_binify(temp), temp);
BX_DecRef(temp);
}

CHECK_NULL_1(temp, _bx_op_new(op->kind, n1, items1), xs[0]);
CHECK_NULL_1(temp, _bx_op_new(op->kind, n1, right), xs[0]);
CHECK_NULL_2(xs[1], _commutative_binify(temp), xs[0], temp);
BX_DecRef(temp);

Expand Down
2 changes: 1 addition & 1 deletion extension/boolexpr/boolexpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ bool BX_Iter_Next(struct BX_Iter *);


/* Return a new array of Boolean expressions. */
struct BX_Array * BX_Array_New(size_t length, struct BoolExpr **items);
struct BX_Array * BX_Array_New(size_t length, struct BoolExpr **exprs);

/* Delete an array of Boolean expressions. */
void BX_Array_Del(struct BX_Array *);
Expand Down
20 changes: 10 additions & 10 deletions extension/boolexpr/nnf.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,22 @@ _xor_nnfify_conj(struct BoolExpr *op)
size_t mid = op->data.xs->length / 2;
size_t n0 = mid;
size_t n1 = op->data.xs->length - mid;
struct BoolExpr **items0 = op->data.xs->items;
struct BoolExpr **items1 = op->data.xs->items + mid;
struct BoolExpr **left = op->data.xs->items;
struct BoolExpr **right = op->data.xs->items + mid;
struct BoolExpr *xs[2];
struct BoolExpr *temp;

/* Xor(a, b, c, d) <=> Xor(Xor(a, b), Xor(c, d)) */
if (n0 == 1) {
xs[0] = BX_IncRef(items0[0]);
xs[0] = BX_IncRef(left[0]);
}
else {
CHECK_NULL(temp, BX_Xor(n0, items0));
CHECK_NULL(temp, BX_Xor(n0, left));
CHECK_NULL_1(xs[0], _xor_nnfify(temp), temp);
BX_DecRef(temp);
}

CHECK_NULL_1(temp, BX_Xor(n1, items1), xs[0]);
CHECK_NULL_1(temp, BX_Xor(n1, right), xs[0]);
CHECK_NULL_2(xs[1], _xor_nnfify(temp), xs[0], temp);
BX_DecRef(temp);
CHECK_NULL_2(temp, BX_Xor(2, xs), xs[0], xs[1]);
Expand Down Expand Up @@ -109,21 +109,21 @@ _xor_nnfify_disj(struct BoolExpr *op)
size_t mid = op->data.xs->length / 2;
size_t n0 = mid;
size_t n1 = op->data.xs->length - mid;
struct BoolExpr **items0 = op->data.xs->items;
struct BoolExpr **items1 = op->data.xs->items + mid;
struct BoolExpr **left = op->data.xs->items;
struct BoolExpr **right = op->data.xs->items + mid;
struct BoolExpr *xs[2];
struct BoolExpr *temp;

if (n0 == 1) {
xs[0] = BX_IncRef(items0[0]);
xs[0] = BX_IncRef(left[0]);
}
else {
CHECK_NULL(temp, BX_Xor(n0, items0));
CHECK_NULL(temp, BX_Xor(n0, left));
CHECK_NULL_1(xs[0], _xor_nnfify(temp), temp);
BX_DecRef(temp);
}

CHECK_NULL_1(temp, BX_Xor(n1, items1), xs[0]);
CHECK_NULL_1(temp, BX_Xor(n1, right), xs[0]);
CHECK_NULL_2(xs[1], _xor_nnfify(temp), xs[0], temp);
BX_DecRef(temp);
CHECK_NULL_2(temp, BX_Xor(2, xs), xs[0], xs[1]);
Expand Down
12 changes: 6 additions & 6 deletions extension/boolexpr/product.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ static struct BX_Array *
_multiply(BX_Kind kind, struct BX_Array *a, struct BX_Array *b)
{
size_t length = a->length * b->length;
struct BoolExpr **items;
struct BoolExpr **exprs;
struct BX_Array *prod;

items = malloc(length * sizeof(struct BoolExpr *));
if (items == NULL)
exprs = malloc(length * sizeof(struct BoolExpr *));
if (exprs == NULL)
return NULL; // LCOV_EXCL_LINE

for (size_t i = 0, index = 0; i < a->length; ++i) {
for (size_t j = 0; j < b->length; ++j, ++index) {
struct BoolExpr *xs[2] = {a->items[i], b->items[j]};
CHECK_NULL_N(items[index], _bx_op_new(kind, 2, xs), index, items);
CHECK_NULL_N(exprs[index], _bx_op_new(kind, 2, xs), index, exprs);
}
}

prod = _bx_array_from(length, items);
prod = _bx_array_from(length, exprs);

for (size_t i = 0; i < length; ++i)
BX_DecRef(items[i]);
BX_DecRef(exprs[i]);

return prod;
}
Expand Down
2 changes: 1 addition & 1 deletion extension/boolexpr/share.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


/* array.c */
struct BX_Array * _bx_array_from(size_t length, struct BoolExpr **items);
struct BX_Array * _bx_array_from(size_t length, struct BoolExpr **exprs);

/* boolexpr.c */
extern struct BoolExpr * _bx_identity[16];
Expand Down

0 comments on commit 372cf63

Please sign in to comment.