From e53abec881aeb600de5d2369ac5cce1b1da8626b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Repe=C4=87?= Date: Wed, 3 Mar 2021 12:15:41 +0100 Subject: [PATCH] const is faster --- Source/WrapDelphi.pas | 10 +++++----- Source/WrapFireDAC.pas | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Source/WrapDelphi.pas b/Source/WrapDelphi.pas index a9374568..2e29d1d6 100644 --- a/Source/WrapDelphi.pas +++ b/Source/WrapDelphi.pas @@ -836,7 +836,7 @@ TPyDelphiWrapper = class(TEngineClient, IFreeNotificationSubscriber) function RegisterHelperType(APyObjectClass : TPyObjectClass) : TPythonType; function RegisterFunction(AFuncName : PAnsiChar; AFunc : PyCFunction; ADocString : PAnsiChar ): PPyMethodDef; overload; function RegisterFunction(AFuncName : PAnsiChar; AFunc : TDelphiMethod; ADocString : PAnsiChar ): PPyMethodDef; overload; - function GetHelperType(TypeName : string) : TPythonType; + function GetHelperType(const TypeName : string) : TPythonType; // Function that provides a Python object wrapping an object function Wrap(AObj : TObject; AOwnership: TObjectOwnership = soReference) : PPyObject; {$IFDEF EXTENDED_RTTI} @@ -845,7 +845,7 @@ TPyDelphiWrapper = class(TEngineClient, IFreeNotificationSubscriber) // Function that provides a Python object wrapping an interface // Note the the interface must be compiled in {$M+} mode and have a guid // Usage: WrapInterface(TValue.From(YourInterfaceReference)) - function WrapInterface(IValue: TValue): PPyObject; + function WrapInterface(const IValue: TValue): PPyObject; {$ENDIF} // properties property EventHandlers : TEventHandlers read fEventHandlerList; @@ -1892,7 +1892,7 @@ function GetRttiAttr(ParentAddr: Pointer; ParentType: TRttiStructuredType; end; function SetRttiAttr(const ParentAddr: Pointer; ParentType: TRttiStructuredType; - AttrName: string; Value: PPyObject; PyDelphiWrapper: TPyDelphiWrapper; + const AttrName: string; Value: PPyObject; PyDelphiWrapper: TPyDelphiWrapper; out ErrMsg: string): Boolean; var Prop: TRttiProperty; @@ -3562,7 +3562,7 @@ procedure TPyDelphiWrapper.Finalize; fEventHandlerList.Clear; end; -function TPyDelphiWrapper.GetHelperType(TypeName: string): TPythonType; +function TPyDelphiWrapper.GetHelperType(const TypeName: string): TPythonType; var Index : integer; begin @@ -3780,7 +3780,7 @@ function TPyDelphiWrapper.WrapRecord(Address: Pointer; Typ: TRttiStructuredType) end; end; -function TPyDelphiWrapper.WrapInterface(IValue: TValue): PPyObject; +function TPyDelphiWrapper.WrapInterface(const IValue: TValue): PPyObject; var PythonType: TPythonType; Address: Pointer; diff --git a/Source/WrapFireDAC.pas b/Source/WrapFireDAC.pas index 2d87498b..3d07f962 100644 --- a/Source/WrapFireDAC.pas +++ b/Source/WrapFireDAC.pas @@ -175,7 +175,7 @@ TPyFireDACRegistration = class(TRegisteredUnit) procedure DefineVars(APyDelphiWrapper : TPyDelphiWrapper); override; end; -function SqlTimeToVarDate(V : Variant) : Variant; +function SqlTimeToVarDate(const V : Variant) : Variant; implementation @@ -2230,7 +2230,7 @@ procedure TPyFireDACRegistration.RegisterWrappers( APyDelphiWrapper.RegisterDelphiWrapper(TPyDBField); end; -function SqlTimeToVarDate(V : Variant) : Variant; +function SqlTimeToVarDate(const V : Variant) : Variant; begin if VarIsSQLTimeStamp(V) or VarIsSQLTimeStampOffset(V) then VarCast(Result, V, varDate)