X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/68ac8381cae336dda0cd718dd6fa43b677f5ef8d..931a750a50f8191665d56c1ec341f6892f1f026c:/blinklist.pas diff --git a/blinklist.pas b/blinklist.pas old mode 100755 new mode 100644 index 27232f4..5ab153a --- a/blinklist.pas +++ b/blinklist.pas @@ -55,10 +55,13 @@ var implementation +uses sysutils; + procedure linklistadd(var baseptr:tlinklist;newptr:tlinklist); var p:tlinklist; begin + if (newptr=baseptr) or assigned(newptr.prev) then raise exception.create('linklist double insertion detected'); p := baseptr; baseptr := newptr; baseptr.prev := nil; @@ -71,12 +74,15 @@ begin if item = baseptr then baseptr := item.next; if item.prev <> nil then item.prev.next := item.next; if item.next <> nil then item.next.prev := item.prev; + item.prev := nil; + item.next := nil; end; procedure linklist2add(var baseptr,newptr:tlinklist2); var p:tlinklist2; begin + if (newptr=baseptr) or assigned(newptr.prev2) then raise exception.create('linklist2 double insertion detected'); p := baseptr; baseptr := newptr; baseptr.prev2 := nil; @@ -89,6 +95,8 @@ begin if item = baseptr then baseptr := item.next2; if item.prev2 <> nil then item.prev2.next2 := item.next2; if item.next2 <> nil then item.next2.prev2 := item.prev2; + item.prev2 := nil; + item.next2 := nil; end; constructor tlinklist.create;