picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 9b3ff8fcbc676cfff16ad981302efb4010dccb2a
parent 81804a4e0ee785a3a25414300acaf4cabdaf9d84
Author: Alexander Burger <abu@software-lab.de>
Date:   Sat, 23 Feb 2013 07:58:17 +0100

Minor clean up
Diffstat:
Msrc/io.c | 14++++++--------
Msrc64/db.l | 15+++++++--------
2 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/io.c b/src/io.c @@ -1,4 +1,4 @@ -/* 22feb13abu +/* 23feb13abu * (c) Software Lab. Alexander Burger */ @@ -3587,16 +3587,16 @@ any doDbck(any ex) { blkPeek(0, buf, 2*BLK); // Get Free, Next BlkLink = getAdr(buf); next = getAdr(buf+BLK); + Jnl = NULL; while (BlkLink) { // Check free list rdBlock(BlkLink); if ((cnt += BLKSIZE) > next) { x = mkStr("Circular free list"); goto done; } - Jnl = NULL; Block[0] |= TAGMASK, wrBlock(); // Mark free list - Jnl = jnl; } + Jnl = jnl; for (p = BLKSIZE; p != next; p += BLKSIZE) { // Check all chains if (rdBlock(p), (Block[0] & TAGMASK) == 0) { cnt += BLKSIZE; @@ -3620,13 +3620,11 @@ any doDbck(any ex) { } } BlkLink = getAdr(buf); // Unmark free list + Jnl = NULL; while (BlkLink) { rdBlock(BlkLink); - if (Block[0] & TAGMASK) { - Jnl = NULL; + if (Block[0] & TAGMASK) Block[0] &= BLKMASK, wrBlock(); - Jnl = jnl; - } } if (cnt != next) x = mkStr("Bad count"); @@ -3638,7 +3636,7 @@ any doDbck(any ex) { x = Pop(c1); } done: - if (Jnl) + if (Jnl = jnl) fflush(Jnl), lockFile(fileno(Jnl), F_SETLK, F_UNLCK); rwUnlock(1); --Env.protect; diff --git a/src64/db.l b/src64/db.l @@ -1,4 +1,4 @@ -# 22feb13abu +# 23feb13abu # (c) Software Lab. Alexander Burger # 6 bytes in little endian format @@ -2037,6 +2037,7 @@ ld E (Y) eval # Eval next arg end + push (DbJnl) # <S IV> Journal push E # <S III> 'flg' push ZERO # <S II> 'syms' push ZERO # <S I> 'blks' @@ -2056,6 +2057,7 @@ call getAdrZ_A # Get 'next' push A # <S> 'next' ld Y BLKSIZE # 'cnt' in Y + ld (DbJnl) 0 # Disable Journal do # Check free list ld A (BlkLink) # Next block? null A @@ -2068,13 +2070,11 @@ call mkStrE_E # Return message jmp 90 end - push (DbJnl) # Disable Journal - ld (DbJnl) 0 ld Z (DbBlock) # Block buffer in Z again or (Z) BLKTAG # Mark free list call wrBlockZ # Write block - pop (DbJnl) # Restore Journal loop + ld (DbJnl) (S IV) # Restore Journal ld X BLKSIZE # 'p' in X do # Check all chains cmp X (S) # Reached 'next'? @@ -2130,6 +2130,7 @@ ld Z Buf # Get 'free' call getAdrZ_A ld (BlkLink) A # Store as next block + ld (DbJnl) 0 # Disable Journal do # Unmark free list null A # Any? while nz # Yes @@ -2138,11 +2139,8 @@ ld B (Z) # Get tag byte and B BLKTAG # Block tag non-zero? if nz # Nes - push (DbJnl) # Disable Journal - ld (DbJnl) 0 off (Z) BLKTAG # Clear tag call wrBlockZ # Write block - pop (DbJnl) # Restore Journal end ld A (BlkLink) # Get next block loop @@ -2160,7 +2158,8 @@ end end 90 add S IV # Drop 'next', 'blks', 'syms' and 'flg' - null (DbJnl) # Journal? + pop (DbJnl) # Restore Journal + null (DbJnl) # Any? if nz # Yes call unLockJnl # Unlock journal end