Forum > FPC development
[SOLVED] Improvement of rtl/objpas/sysutils/sysstr.inc function CompareStr
(1/1)
lagprogramming:
The function has a useless declaration of variable "res". Also useless is the initial "result := 0;" assignment.
Here is the content of the function.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function CompareStr(const S1, S2: string): Integer;var res,count, count1, count2: SizeInt;begin result := 0; Count1 := Length(S1); Count2 := Length(S2); if Count1>Count2 then Count:=Count2 else Count:=Count1; result := CompareMemRange(Pointer(S1),Pointer(S2), Count); if result=0 then // CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer) result:=CAPSIZEINT(Count1-Count2);end;
lagprogramming:
Here is a patch
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.incindex 318ef2c03c..ee45222d2f 100644--- a/rtl/objpas/sysutils/sysstr.inc+++ b/rtl/objpas/sysutils/sysstr.inc@@ -181,9 +181,8 @@ function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}in {$ENDIF} function CompareStr(const S1, S2: string): Integer;-var res,count, count1, count2: SizeInt;+var count, count1, count2: SizeInt; begin- result := 0; Count1 := Length(S1); Count2 := Length(S2); if Count1>Count2 then
Navigation
[0] Message Index