Hi Andreas,
On 2018-05-28 13:28, Andreas Reichel wrote:
On Mon, May 28, 2018 at 01:05:58PM +0200, Claudius Heine wrote:
Hi Andreas,
here we go again ;)
On 2018-05-25 14:00, [ext] Andreas J. Reichel wrote:
From: Andreas Reichel <[email protected]>
+++ b/utils.c
@@ -32,6 +32,11 @@ void __noreturn error_exit(CHAR16 *message, EFI_STATUS
status)
unreachable();
}
+VOID sleep(int32_t sec)
+{
+ uefi_call_wrapper(BS->Stall, 1, sec * 1000 * 1000);
+}
+
Why not as macro? (I guess because of the includes?)
Because I wrote it as a function.
Technically you gave no reason.
What you wanted to have is some kind of parameter binding to an existing
function and shortening the name.
I do such things normally with macros or inline functions. That is the
pattern I am used to. Argument is: better performance and memory usage.
That might not be that much if you have just some small cases. And with
a sleep that takes whole seconds as a parameter and only used for
debugging not important. But it might get more if used constantly or on
performance critical paths and can be avoided very simply. So its good
to get used to programming this way generally.
Anyway, you could also put a 'inline' there.
No, an 'inline' is static and static is the opposite of what I want.
Extern inline would be possible but that would produce the same code
inside the scope of each translation unit which is rather... hm ugly?
On the other hand... the compiler may decide to not inline the function.
Claudius
VOID *mmalloc(UINTN bytes)
{
EFI_STATUS status;
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: [email protected]
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: [email protected]
--
You received this message because you are subscribed to the Google Groups "EFI Boot
Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/efibootguard-dev/8c6fefb1-5a3e-3d68-d297-202567bccc81%40siemens.com.
For more options, visit https://groups.google.com/d/optout.