fix in reference counts for sets
This commit is contained in:
parent
a24c90f5a9
commit
688567a532
2 changed files with 8 additions and 7 deletions
|
@ -311,11 +311,6 @@ ChkExLinkOrName(expp)
|
||||||
if (df->df_kind & (D_ENUM | D_CONST)) {
|
if (df->df_kind & (D_ENUM | D_CONST)) {
|
||||||
/* Replace an enum-literal or a CONST identifier by its value.
|
/* Replace an enum-literal or a CONST identifier by its value.
|
||||||
*/
|
*/
|
||||||
if (df->df_type->tp_fund == T_SET) {
|
|
||||||
expp->nd_class = Set;
|
|
||||||
inc_refcount(expp->nd_set);
|
|
||||||
}
|
|
||||||
else expp->nd_class = Value;
|
|
||||||
if (df->df_kind == D_ENUM) {
|
if (df->df_kind == D_ENUM) {
|
||||||
expp->nd_INT = df->enm_val;
|
expp->nd_INT = df->enm_val;
|
||||||
expp->nd_symb = INTEGER;
|
expp->nd_symb = INTEGER;
|
||||||
|
@ -327,6 +322,11 @@ ChkExLinkOrName(expp)
|
||||||
expp->nd_token = df->con_const;
|
expp->nd_token = df->con_const;
|
||||||
expp->nd_lineno = ln;
|
expp->nd_lineno = ln;
|
||||||
}
|
}
|
||||||
|
if (df->df_type->tp_fund == T_SET) {
|
||||||
|
expp->nd_class = Set;
|
||||||
|
inc_refcount(expp->nd_set);
|
||||||
|
}
|
||||||
|
else expp->nd_class = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(df->df_kind & D_VALUE)) {
|
if (!(df->df_kind & D_VALUE)) {
|
||||||
|
@ -426,7 +426,7 @@ MkSet(size)
|
||||||
{
|
{
|
||||||
register arith *s;
|
register arith *s;
|
||||||
|
|
||||||
size = ((size + (int)word_size - 1) / (int)word_size + 1) * sizeof(arith);
|
size = (size / (int) word_size + 1) * sizeof(arith);
|
||||||
s = (arith *) Malloc(size);
|
s = (arith *) Malloc(size);
|
||||||
clear((char *) s , size);
|
clear((char *) s , size);
|
||||||
s++;
|
s++;
|
||||||
|
@ -439,6 +439,7 @@ FreeSet(s)
|
||||||
{
|
{
|
||||||
dec_refcount(s);
|
dec_refcount(s);
|
||||||
if (refcount(s) <= 0) {
|
if (refcount(s) <= 0) {
|
||||||
|
assert(refcount(s) == 0);
|
||||||
free((char *) (s-1));
|
free((char *) (s-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ cstset(expp)
|
||||||
assert(expp->nd_symb == IN || expp->nd_left->nd_class == Set);
|
assert(expp->nd_symb == IN || expp->nd_left->nd_class == Set);
|
||||||
|
|
||||||
set2 = expp->nd_right->nd_set;
|
set2 = expp->nd_right->nd_set;
|
||||||
setsize = (unsigned) expp->nd_right->nd_type->tp_size / (unsigned) word_size;
|
setsize = (unsigned) (expp->nd_right->nd_type->tp_size) / (unsigned) word_size;
|
||||||
|
|
||||||
if (expp->nd_symb == IN) {
|
if (expp->nd_symb == IN) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
Loading…
Reference in a new issue