diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-08-24 12:40:39 +1000 |
---|---|---|
committer | Alexey Kardashevskiy <aik@ozlabs.ru> | 2016-08-24 12:40:39 +1000 |
commit | 87744e739d09d3b9b12754b15634f0ad1dd0a481 (patch) | |
tree | 0b1721e95d34fcff4de884e550ba2dd8e17e8989 /slof | |
parent | faa7208616a1774bc7eb520c82c5c739a527017c (diff) | |
download | SLOF-87744e739d09d3b9b12754b15634f0ad1dd0a481.zip SLOF-87744e739d09d3b9b12754b15634f0ad1dd0a481.tar.gz SLOF-87744e739d09d3b9b12754b15634f0ad1dd0a481.tar.bz2 |
instance: Fix set-my-args for empty arguments
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@kernel.crashing.org>
[aik: removed "if" as Segher suggested; removed pipe from comment as Thomas suggested]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'slof')
-rw-r--r-- | slof/fs/instance.fs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/slof/fs/instance.fs b/slof/fs/instance.fs index 9e5c921..77eee15 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 ( ) ; \ Current node has already been set, when this is called. |