X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=accesslog.cpp;fp=accesslog.cpp;h=4a54fdb8692b63c72ec6f85b8d37e37db5f7f125;hp=af53872e6ec03c0d68f83b86e4b9c9f83320eb6d;hb=a0fe013448d188b324c00383cfd91695d9d3d076;hpb=26fe3ab755034ea3be8321ec0af548670f8c3bd8 diff --git a/accesslog.cpp b/accesslog.cpp index af53872..4a54fdb 100644 --- a/accesslog.cpp +++ b/accesslog.cpp @@ -14,12 +14,12 @@ using namespace std; AccessLogThread::AccessLogThread() { - pthread_mutex_init(&mutex, NULL); + pthread_mutex_init(&mutex, nullptr); } AccessLogThread::AccessLogThread(const string &filename) : filename(filename) { - pthread_mutex_init(&mutex, NULL); + pthread_mutex_init(&mutex, nullptr); } void AccessLogThread::write(const ClientStats& client) @@ -35,10 +35,10 @@ void AccessLogThread::do_work() { // Open the file. if (filename.empty()) { - logfp = NULL; + logfp = nullptr; } else { logfp = fopen(filename.c_str(), "a+"); - if (logfp == NULL) { + if (logfp == nullptr) { log_perror(filename.c_str()); // Continue as before. } @@ -52,7 +52,7 @@ void AccessLogThread::do_work() swap(pending_writes, writes); } - if (logfp != NULL) { + if (logfp != nullptr) { // Do the actual writes. timespec now_monotonic; timespec now_realtime; @@ -82,14 +82,14 @@ void AccessLogThread::do_work() // Wait until we are being woken up, either to quit or because // there is material in pending_writes. - wait_for_wakeup(NULL); + wait_for_wakeup(nullptr); } - if (logfp != NULL) { + if (logfp != nullptr) { if (fclose(logfp) == EOF) { log_perror("fclose"); } } - logfp = NULL; + logfp = nullptr; }