From 965968e38f6e7a8806329b96aa22044c1769231a Mon Sep 17 00:00:00 2001 From: kelson42 Date: Fri, 29 Aug 2014 02:46:25 -0600 Subject: [PATCH] + small simplification of the code --- src/server/kiwix-serve.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 88d1e1c..096ecb8 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -239,7 +239,6 @@ static int accessHandlerCallback(void *cls, if (reader == NULL) { humanReadableBookId=""; } - pthread_mutex_unlock(&mapLock); /* Get suggestions */ @@ -330,10 +329,9 @@ static int accessHandlerCallback(void *cls, /* Display a random article */ else if (!strcmp(url, "/random")) { cacheEnabled = false; - std::string randomUrl; if (reader != NULL) { pthread_mutex_lock(&readerLock); - randomUrl = reader->getRandomPageUrl(); + std::string randomUrl = reader->getRandomPageUrl(); pthread_mutex_unlock(&readerLock); httpRedirection = "/" + humanReadableBookId + "/" + randomUrl; } @@ -598,7 +596,7 @@ int main(int argc, char **argv) { vector booksIds = libraryManager.getBooksIds(); vector::iterator itr; kiwix::Book currentBook; - for ( itr = booksIds.begin(); itr != booksIds.end(); ++itr ) { + for (itr = booksIds.begin(); itr != booksIds.end(); ++itr) { bool zimFileOk = false; libraryManager.getBookById(*itr, currentBook); zimPath = currentBook.pathAbsolute;