[PATCH] nss: Simplify move_and_align

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What this function does can be written much shorter.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tools/nss/libvirt_nss.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index de34baf..587b171 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -263,12 +263,10 @@ move_and_align(void *buf, size_t len, size_t *idx)
     char *buffer = buf;
     size_t move = LIBVIRT_ALIGN(len);
 
-    if (!idx)
-        return buffer + move;
+    if (idx)
+        *idx += move;
 
-    *idx += move;
-
-    return buffer + *idx;
+    return buffer + move;
 }
 
 enum nss_status
-- 
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]