Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2025-11

ATT Juha Manninen - commit #957f1d68 LazUtils: Remove duplicate IsASCII() functions.

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Juha Manninen
to Flávio Etrusco

On Sun, Nov 16, 2025 at 9:44?PM Fl?vio Etrusco via lazarus <

Show quoted text 9 lines
wrote: WRT to commit https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/957f1d681fe1b80fb1cc5ee8a5c09845c8689996 I guess the commit should be reverted (and reversed) since IsAscii is the oldest function and is better named?

The 2 removed IsAscii functions were local, only visible in their own units. LazUtf8 had a public IsPureAscii in addition to a local IsAscii. Yes, maybe IsAscii is a better name. IsPureAscii should be an alias and deprecated then.

Unit Pas2jsFileUtils in FPC sources has a similar IsASCII. For some reason it has 2 implementations depending on Pas2js define. I guess Pas2js cannot handle pointers. They both do the same thing anyway.

function IsASCII(const s: string): boolean; inline;
{$IFDEF Pas2js}
var
  i: Integer;
begin
  for i:=1 to length(s) do
    if s[i]>#127 then exit(false);
  Result:=true;
end;
{$ELSE}
var
  p: PChar;
begin
  if s='' then exit(true);
  p:=PChar(s);
  repeat
    case p^ of
    #0: if p-PChar(s)=length(s) then exit(true);
    #128..#255: exit(false);
    end;
    inc(p);
  until false;
end;
{$ENDIF}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20251116/903aad27/attachment.htm>

Reply by email