diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2013-06-25 22:18:41 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2013-06-25 22:18:41 +0200 |
commit | c9dfae7a17ea4e5a2e114df331942f70d48bfe5b (patch) | |
tree | ecb078dd2e97ec1f2d56ae99da54f6d3028015d1 /samsung-ipc/wakelock.c | |
parent | 0e0c698a13ae658640af085591b809bbc9a6f658 (diff) | |
download | external_libsamsung-ipc-c9dfae7a17ea4e5a2e114df331942f70d48bfe5b.zip external_libsamsung-ipc-c9dfae7a17ea4e5a2e114df331942f70d48bfe5b.tar.gz external_libsamsung-ipc-c9dfae7a17ea4e5a2e114df331942f70d48bfe5b.tar.bz2 |
Refactor code for consistent coding style and avoid using assert
Change-Id: Idca5edb70869e07d35744301b185df02e42f5b4c
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc/wakelock.c')
-rw-r--r-- | samsung-ipc/wakelock.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/samsung-ipc/wakelock.c b/samsung-ipc/wakelock.c index 5946809..2e42671 100644 --- a/samsung-ipc/wakelock.c +++ b/samsung-ipc/wakelock.c @@ -1,4 +1,4 @@ -/** +/* * This file is part of libsamsung-ipc. * * Copyright (C) 2012 Alexander Tarasikov <alexander.tarasikov@gmail.com> @@ -18,11 +18,11 @@ * */ -#include <assert.h> -#include <fcntl.h> -#include <wakelock.h> #include <stdlib.h> #include <string.h> +#include <fcntl.h> + +#include <wakelock.h> static int wake_lock_fd = -1; static int wake_unlock_fd = -1; @@ -30,7 +30,9 @@ static int wake_unlock_fd = -1; int wake_lock(char *lock_name) { int rc; - assert(lock_name != NULL); + + if (lock_name == NULL) + return -1; if (wake_lock_fd < 0) wake_lock_fd = open("/sys/power/wake_lock", O_RDWR); @@ -46,7 +48,9 @@ int wake_lock(char *lock_name) int wake_unlock(char *lock_name) { int rc; - assert(lock_name != NULL); + + if (lock_name == NULL) + return -1; if (wake_unlock_fd < 0) wake_unlock_fd = open("/sys/power/wake_unlock", O_RDWR); @@ -58,3 +62,5 @@ int wake_unlock(char *lock_name) return rc; } + +// vim:ts=4:sw=4:expandtab |