mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-24 15:10:13 +01:00
laz2xmlcfg: duplicate nodes: always use the first
git-svn-id: trunk@47171 -
This commit is contained in:
parent
890803a8be
commit
98578ff53a
@ -612,7 +612,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
SetLength(Children,aCount);
|
SetLength(Children,aCount);
|
||||||
if aCount>1 then
|
if aCount>1 then
|
||||||
MergeSort(@Children[0],aCount,@CompareDomNodeNames); // soet ascending [0]<[1]
|
MergeSort(@Children[0],aCount,@CompareDomNodeNames); // sort ascending [0]<[1]
|
||||||
|
for m:=0 to aCount-2 do
|
||||||
|
if Children[m].NodeName=Children[m+1].NodeName then begin
|
||||||
|
// duplicate found: nodes with same name
|
||||||
|
// -> use only the first
|
||||||
|
Children[m+1]:=Children[m];
|
||||||
|
end;
|
||||||
ChildrenValid:=true;
|
ChildrenValid:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,11 @@ uses
|
|||||||
|
|
||||||
function ComparePointers(p1, p2: Pointer): integer; inline;
|
function ComparePointers(p1, p2: Pointer): integer; inline;
|
||||||
|
|
||||||
|
{ MergeSort:
|
||||||
|
sort ascending, e.g. Compare(List[0],List[1])<0
|
||||||
|
keeping order (for each i<j and Compare(List[i],List[j])=0) }
|
||||||
procedure MergeSort(List: PPointer; ListLength: PtrInt;
|
procedure MergeSort(List: PPointer; ListLength: PtrInt;
|
||||||
const Compare: TListSortCompare); // sort ascending, e.g. Compare(List[0],List[1])<0
|
const Compare: TListSortCompare);
|
||||||
|
|
||||||
function GetNextDelimitedItem(const List: string; Delimiter: char;
|
function GetNextDelimitedItem(const List: string; Delimiter: char;
|
||||||
var Position: integer): string;
|
var Position: integer): string;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user