X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/4782a5c5afee47721cc617daa40dd29828342c2b..a1858883733a454b6ffb73aa263ef5badc2a1d07:/blinklist.pas diff --git a/blinklist.pas b/blinklist.pas index 2079b75..5ab153a 100755 --- a/blinklist.pas +++ b/blinklist.pas @@ -1,21 +1,9 @@ -(* - * beware IRC services, blinklist.pas - * Copyright (C) 2002 Bas Steendijk - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - *) + +{ Copyright (C) 2005 Bas Steendijk + For conditions of distribution and use, see copyright notice in zlib_license.txt + which is included in the package + ----------------------------------------------------------------------------- } + unit blinklist; {$ifdef fpc} {$mode delphi} @@ -67,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; @@ -83,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; @@ -101,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;