From 1f93f0836484ccc1abe335f5bd2cfd35df0b7631 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 16 Feb 2013 14:17:57 +0100 Subject: tdb: Simplify fcntl_lock() a bit All arguments but the cmd are the same. To me this looks a bit better and saves some bytes in the object code. Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- lib/tdb/common/lock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/tdb') diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c index dadc69e8cd..16963df097 100644 --- a/lib/tdb/common/lock.c +++ b/lib/tdb/common/lock.c @@ -36,6 +36,7 @@ static int fcntl_lock(struct tdb_context *tdb, int rw, off_t off, off_t len, bool waitflag) { struct flock fl; + int cmd; fl.l_type = rw; fl.l_whence = SEEK_SET; @@ -43,10 +44,9 @@ static int fcntl_lock(struct tdb_context *tdb, fl.l_len = len; fl.l_pid = 0; - if (waitflag) - return fcntl(tdb->fd, F_SETLKW, &fl); - else - return fcntl(tdb->fd, F_SETLK, &fl); + cmd = waitflag ? F_SETLKW : F_SETLK; + + return fcntl(tdb->fd, cmd, &fl); } static int fcntl_unlock(struct tdb_context *tdb, int rw, off_t off, off_t len) -- cgit