Sign in Join

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

Mailing lists / lazarus / 2018-05

LConvEncoding- why inline func?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

AlexeyT
procedure InternalUTF8ToCP(const s: string; TargetCodePage: TSystemCodePage;
   SetTargetCodePage: boolean;
   const UTF8CharConvFunc: TUnicodeToCharID;
   out TheResult: RawByteString); inline;
begin
   if not Assigned(UTF8CharConvFunc) then
   begin
     TheResult:=s;
     SetCodePage(TheResult, TargetCodePage, True);
     if not SetTargetCodePage then
       SetCodePage(TheResult, CP_ACP, False);
   end else begin
     TheResult:=UTF8ToSingleByte(s,UTF8CharConvFunc);
     if SetTargetCodePage then
       SetCodePage(TheResult, TargetCodePage, False);
   end;
end;

Func is complex, why it's inline?

Regards, Alexey

Reply by email

Mattias Gaertner
to AlexeyT
Show quoted text 19 lines
procedure InternalUTF8ToCP(const s: string; TargetCodePage: TSystemCodePage;   SetTargetCodePage: boolean;   const UTF8CharConvFunc: TUnicodeToCharID;   out TheResult: RawByteString); inline; begin   if not Assigned(UTF8CharConvFunc) then   begin     TheResult:=s;     SetCodePage(TheResult, TargetCodePage, True);     if not SetTargetCodePage then       SetCodePage(TheResult, CP_ACP, False);   end else begin     TheResult:=UTF8ToSingleByte(s,UTF8CharConvFunc);     if SetTargetCodePage then       SetCodePage(TheResult, TargetCodePage, False);   end; end; Func is complex, why it's inline?

It is not supposed to be used directly. It is supposed to be used by a few other functions, which are called a lot.

Mattias

Reply by email