[SLOF] [PATCH slof v2] instance: Fix set-my-args for empty arguments
Thomas Huth
thuth at redhat.com
Tue Aug 23 08:29:39 AEST 2016
On 22.08.2016 06:27, Alexey Kardashevskiy wrote:
> From: Benjamin Herrenschmidt <benh at kernel.crashing.org>
>
> It would put the pointer and len in the wrong order in the instance>args
> buffer. As alloc-mem can handle zero length itself (and return NULL),
> this also removes "if" to make the code simpler.
>
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> [aik: removed "if" as Segher suggested]
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
> ---
> slof/fs/instance.fs | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/slof/fs/instance.fs b/slof/fs/instance.fs
> index 9e5c921..9159a5d 100644
> --- a/slof/fs/instance.fs
> +++ b/slof/fs/instance.fs
> @@ -129,13 +129,9 @@ CONSTANT <instancevariable>
>
> \ copy args from original instance to new created
> : set-my-args ( old-addr len -- )
> - dup IF \ IF len > 0 ( old-addr len )
> - dup alloc-mem \ | allocate space for new args ( old-addr len new-addr )
> - 2dup my-self instance>args 2! \ | write into instance struct ( old-addr len new-addr )
> - swap move \ | and copy the args ( )
> - ELSE \ ELSE ( old-addr len )
> - my-self instance>args 2! \ | set new args to zero, too ( )
> - THEN \ FI
> + dup alloc-mem \ | allocate space for new args ( old-addr len new-addr )
> + 2dup my-self instance>args 2! \ | write into instance struct ( old-addr len new-addr )
> + swap move \ | and copy the args ( )
I think you could now remove the pipe --^ characters in the comment now
that the IF-statement is gone. Apart from that cosmetic nit, the patch
looks fine to me.
Reviewed-by: Thomas Huth <thuth at redhat.com>
More information about the SLOF
mailing list