Forum > FPC development

[SOLVED] Simplified ExcludeLeadingPathDelimiter

(1/1)

lagprogramming:
rtl/objpas/sysutils/fina.inc has

--- 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 ExcludeLeadingPathDelimiter(Const Path: PathStr): PathStr; Var  L : Integer; begin  Result:=Path;  L:=Length(Result);  If (L>0) and CharInSet(Result[1],AllowDirectorySeparators) then    Delete(Result,1,1);end;After replacing "If (L>0)" with "If (Result<>'')" and removing the variable "L", the function becomes:

--- 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 ExcludeLeadingPathDelimiter(Const Path: PathStr): PathStr;begin  Result:=Path;  If (Result<>'') and CharInSet(Result[1],AllowDirectorySeparators) then    Delete(Result,1,1);end;
A patch is attached.

Fibonacci:
Why don't you submit these patches on gitlab?

AlexTP:
Postted to https://gitlab.com/freepascal.org/fpc/source/-/issues/40415

AlexTP:
Sorry for the last comment-- I misread the code and 'found' for-loop.

Fibonacci:
Yeah I was wondering where is that loop :D

Navigation

[0] Message Index

Go to full version