mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 18:39:19 +02:00
* patch from Sergei Gorelkin to return ansi/widestrings by reference
in an invisible parameter (Delphi compatible, faster/smaller code) git-svn-id: trunk@9718 -
This commit is contained in:
parent
cc90b67b4a
commit
cdfb7c8f26
@ -139,7 +139,7 @@ implementation
|
||||
begin
|
||||
ret_in_param:=((def.typ=arraydef) and not(is_dynamic_array(def))) or
|
||||
(def.typ=recorddef) or
|
||||
((def.typ=stringdef) and (tstringdef(def).stringtype in [st_shortstring,st_longstring])) or
|
||||
(def.typ=stringdef) or
|
||||
((def.typ=procvardef) and (po_methodpointer in tprocvardef(def).procoptions)) or
|
||||
{ interfaces are also passed by reference to be compatible with delphi and COM }
|
||||
((def.typ=objectdef) and (is_object(def) or is_interface(def))) or
|
||||
|
@ -501,6 +501,7 @@ implementation
|
||||
{ must be the return value finalized before reraising the exception? }
|
||||
if (not is_void(current_procinfo.procdef.returndef)) and
|
||||
(current_procinfo.procdef.returndef.needs_inittable) and
|
||||
(not paramanager.ret_in_param(current_procinfo.procdef.returndef, current_procinfo.procdef.proccalloption)) and
|
||||
(not is_class(current_procinfo.procdef.returndef)) then
|
||||
addstatement(newstatement,finalize_data_node(load_result_node));
|
||||
end;
|
||||
|
@ -737,6 +737,7 @@ begin
|
||||
PByte(ResultAddress+Size)^:=0;
|
||||
end;
|
||||
end;
|
||||
fpc_ansistr_decr_ref(Pointer(fpc_ansistr_copy));
|
||||
Pointer(fpc_ansistr_Copy):=ResultAddress;
|
||||
end;
|
||||
|
||||
|
@ -1228,6 +1228,7 @@ begin
|
||||
PWideChar(ResultAddress+Size*sizeof(WideChar))^:=#0;
|
||||
end;
|
||||
end;
|
||||
fpc_widestr_decr_ref(Pointer(fpc_widestr_copy));
|
||||
Pointer(fpc_widestr_Copy):=ResultAddress;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user