Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
1ffdd573
Commit
1ffdd573
authored
Mar 11, 2015
by
Alexandre Duret-Lutz
Browse files
[buddy] backport some fixes from upstream
* src/fdd.c, src/imatrix.c, src/kernel.c, src/reorder.c: Here.
parent
2d13fd50
Changes
4
Hide whitespace changes
Inline
Side-by-side
buddy/src/fdd.c
View file @
1ffdd573
...
...
@@ -143,9 +143,10 @@ int fdd_extdomain(int *dom, int num)
{
fdvaralloc
+=
(
num
>
fdvaralloc
)
?
num
:
fdvaralloc
;
d
omain
=
(
Domain
*
)
realloc
(
domain
,
sizeof
(
Domain
)
*
fdvaralloc
);
if
(
domain
==
NULL
)
D
omain
*
tmp_ptr
=
(
Domain
*
)
realloc
(
domain
,
sizeof
(
Domain
)
*
fdvaralloc
);
if
(
tmp_ptr
==
NULL
)
return
bdd_error
(
BDD_MEMORY
);
domain
=
tmp_ptr
;
}
}
...
...
@@ -219,9 +220,10 @@ int fdd_overlapdomain(int v1, int v2)
{
fdvaralloc
+=
fdvaralloc
;
d
omain
=
(
Domain
*
)
realloc
(
domain
,
sizeof
(
Domain
)
*
fdvaralloc
);
if
(
domain
==
NULL
)
D
omain
*
tmp_ptr
=
(
Domain
*
)
realloc
(
domain
,
sizeof
(
Domain
)
*
fdvaralloc
);
if
(
tmp_ptr
==
NULL
)
return
bdd_error
(
BDD_MEMORY
);
domain
=
tmp_ptr
;
}
d
=
&
domain
[
fdvarnum
];
...
...
buddy/src/imatrix.c
View file @
1ffdd573
...
...
@@ -46,7 +46,7 @@ imatrix* imatrixNew(int size)
{
imatrix
*
mtx
=
NEW
(
imatrix
,
1
);
int
n
,
m
;
if
(
!
mtx
)
return
NULL
;
...
...
@@ -62,6 +62,7 @@ imatrix* imatrixNew(int size)
{
for
(
m
=
0
;
m
<
n
;
m
++
)
free
(
mtx
->
rows
[
m
]);
free
(
mtx
->
rows
);
free
(
mtx
);
return
NULL
;
}
...
...
@@ -96,7 +97,7 @@ void imatrixFPrint(imatrix *mtx, FILE *ofile)
for
(
x
=
0
;
x
<
mtx
->
size
;
x
++
)
fprintf
(
ofile
,
"%c"
,
x
<
26
?
(
x
+
'a'
)
:
(
x
-
26
)
+
'A'
);
fprintf
(
ofile
,
"
\n
"
);
for
(
y
=
0
;
y
<
mtx
->
size
;
y
++
)
{
fprintf
(
ofile
,
"%2d %c"
,
y
,
y
<
26
?
(
y
+
'a'
)
:
(
y
-
26
)
+
'A'
);
...
...
@@ -141,7 +142,7 @@ void main(void)
imatrixSet(m,0,2);
imatrixSet(m,8,8);
imatrixSet(m,15,15);
imatrixPrint(m);
}
#endif
...
...
buddy/src/kernel.c
View file @
1ffdd573
/*========================================================================
Copyright (C) 1996-2002 by Jorn Lind-Nielsen
Copyright (C) 1996-2002
, 2015
by Jorn Lind-Nielsen
All rights reserved
Permission is hereby granted, without written agreement and without
...
...
@@ -334,22 +334,25 @@ int bdd_setvarnum(int num)
}
else
{
if
(
__unlikely
((
bddvarset
=
(
BDD
*
)
realloc
(
bddvarset
,
sizeof
(
BDD
)
*
num
*
2
))
==
NULL
))
BDD
*
tmp_ptr
=
(
BDD
*
)
realloc
(
bddvarset
,
sizeof
(
BDD
)
*
num
*
2
);
if
(
__unlikely
(
tmp_ptr
==
NULL
))
return
bdd_error
(
BDD_MEMORY
);
if
(
__unlikely
((
bddlevel2var
=
(
int
*
)
realloc
(
bddlevel2var
,
sizeof
(
int
)
*
(
num
+
1
)))
==
NULL
))
bddvarset
=
tmp_ptr
;
int
*
tmp_ptr2
=
(
int
*
)
realloc
(
bddlevel2var
,
sizeof
(
int
)
*
(
num
+
1
));
if
(
__unlikely
(
tmp_ptr2
==
NULL
))
{
free
(
bddvarset
);
return
bdd_error
(
BDD_MEMORY
);
}
if
(
__unlikely
((
bddvar2level
=
(
int
*
)
realloc
(
bddvar2level
,
sizeof
(
int
)
*
(
num
+
1
)))
==
NULL
))
bddlevel2var
=
tmp_ptr2
;
tmp_ptr2
=
(
int
*
)
realloc
(
bddvar2level
,
sizeof
(
int
)
*
(
num
+
1
));
if
(
__unlikely
(
tmp_ptr2
==
NULL
))
{
free
(
bddvarset
);
free
(
bddlevel2var
);
return
bdd_error
(
BDD_MEMORY
);
}
bddvar2level
=
tmp_ptr2
;
}
if
(
__likely
(
bddrefstack
!=
NULL
))
...
...
buddy/src/reorder.c
View file @
1ffdd573
...
...
@@ -812,7 +812,7 @@ static void addref_rec(int r, char *dep)
if
(
r
<
2
)
return
;
if
(
bddnodes
[
r
].
refcou
==
0
)
if
(
bddnodes
[
r
].
refcou
==
0
||
MARKED
(
r
)
)
{
bddfreenum
--
;
...
...
@@ -880,7 +880,10 @@ static int mark_roots(void)
}
if
((
extroots
=
(
int
*
)(
malloc
(
sizeof
(
int
)
*
extrootsize
)))
==
NULL
)
return
bdd_error
(
BDD_MEMORY
);
{
free
(
dep
);
return
bdd_error
(
BDD_MEMORY
);
}
iactmtx
=
imatrixNew
(
bddvarnum
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment