From 031caaf9b7745bfc552cc86fb475de1f18d0fd6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C5=ABnas=20Ma=C5=BEeikis?= Date: Sun, 19 May 2019 17:50:53 +0300 Subject: Protocol: Implemented protocol error reporting. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now public functions of the protocol can return an error code. More work is done on actual logic. Protocol code has bare-bones doxygen documentation. Signed-off-by: Ramūnas Mažeikis --- src/common/utils.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/common/utils.c') diff --git a/src/common/utils.c b/src/common/utils.c index 7e4caa5..956ef1b 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -1,20 +1,9 @@ #include "utils.h" +#include "string.h" int cmp_uuid(uuid_t *first, uuid_t *second) { - if (first->hi == second->hi) { - if (first->low == second->low) { - return 0; - } else if (first->low < second->low) { - return -1; - } else { - return 1; - } - } else if (first->hi < second->hi) { - return -1; - } else { - return 1; - } + return memcmp(first, second, sizeof(*first)); } fpi1_t add(fpi1_t a, fpi1_t b) @@ -36,4 +25,3 @@ fpi1_t div(fpi1_t a, fpi1_t b) { return (fpi1_t)(((long)a * 10) / ((long)b * 10)); } - -- cgit v1.2.3