711 |
#define ABLOCKS_BASE(abase) (abase) |
#define ABLOCKS_BASE(abase) (abase) |
712 |
#else |
#else |
713 |
#define ABLOCKS_BASE(abase) \ |
#define ABLOCKS_BASE(abase) \ |
714 |
(1 & (int) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1]) |
(1 & (long) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1]) |
715 |
#endif |
#endif |
716 |
|
|
717 |
/* The list of free ablock. */ |
/* The list of free ablock. */ |
792 |
abase->blocks[i].x.next_free = free_ablock; |
abase->blocks[i].x.next_free = free_ablock; |
793 |
free_ablock = &abase->blocks[i]; |
free_ablock = &abase->blocks[i]; |
794 |
} |
} |
795 |
ABLOCKS_BUSY (abase) = (struct ablocks *) aligned; |
ABLOCKS_BUSY (abase) = (struct ablocks *) (long) aligned; |
796 |
|
|
797 |
eassert (0 == ((EMACS_UINT)abase) % BLOCK_ALIGN); |
eassert (0 == ((EMACS_UINT)abase) % BLOCK_ALIGN); |
798 |
eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */ |
eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */ |
799 |
eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase); |
eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase); |
800 |
eassert (ABLOCKS_BASE (abase) == base); |
eassert (ABLOCKS_BASE (abase) == base); |
801 |
eassert (aligned == (int)ABLOCKS_BUSY (abase)); |
eassert (aligned == (long) ABLOCKS_BUSY (abase)); |
802 |
} |
} |
803 |
|
|
804 |
abase = ABLOCK_ABASE (free_ablock); |
abase = ABLOCK_ABASE (free_ablock); |
805 |
ABLOCKS_BUSY (abase) = (struct ablocks *) (2 + (int) ABLOCKS_BUSY (abase)); |
ABLOCKS_BUSY (abase) = (struct ablocks *) (2 + (long) ABLOCKS_BUSY (abase)); |
806 |
val = free_ablock; |
val = free_ablock; |
807 |
free_ablock = free_ablock->x.next_free; |
free_ablock = free_ablock->x.next_free; |
808 |
|
|
834 |
ablock->x.next_free = free_ablock; |
ablock->x.next_free = free_ablock; |
835 |
free_ablock = ablock; |
free_ablock = ablock; |
836 |
/* Update busy count. */ |
/* Update busy count. */ |
837 |
ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (int) ABLOCKS_BUSY (abase)); |
ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (long) ABLOCKS_BUSY (abase)); |
838 |
|
|
839 |
if (2 > (int) ABLOCKS_BUSY (abase)) |
if (2 > (long) ABLOCKS_BUSY (abase)) |
840 |
{ /* All the blocks are free. */ |
{ /* All the blocks are free. */ |
841 |
int i = 0, aligned = (int) ABLOCKS_BUSY (abase); |
int i = 0, aligned = (long) ABLOCKS_BUSY (abase); |
842 |
struct ablock **tem = &free_ablock; |
struct ablock **tem = &free_ablock; |
843 |
struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1]; |
struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1]; |
844 |
|
|