Merge pull request #913 from gaul/assert

Prefer abort over assert(false)
This commit is contained in:
Takeshi Nakatani 2019-01-21 21:56:41 +09:00 committed by GitHub
commit 014b8c5982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 10 deletions

View File

@ -22,7 +22,6 @@
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <assert.h>
#include <curl/curl.h>
#include <sstream>
#include <fstream>
@ -56,7 +55,7 @@ AdditionalHeader::AdditionalHeader()
if(this == AdditionalHeader::get()){
is_enable = false;
}else{
assert(false);
abort();
}
}
@ -65,7 +64,7 @@ AdditionalHeader::~AdditionalHeader()
if(this == AdditionalHeader::get()){
Unload();
}else{
assert(false);
abort();
}
}

View File

@ -28,7 +28,6 @@
#include <stdint.h>
#include <pthread.h>
#include <string.h>
#include <assert.h>
#include <syslog.h>
#include <string>
#include <map>
@ -148,7 +147,7 @@ StatCache::StatCache() : IsExpireTime(false), IsExpireIntervalType(false), Expir
stat_cache.clear();
pthread_mutex_init(&(StatCache::stat_cache_lock), NULL);
}else{
assert(false);
abort();
}
}
@ -158,7 +157,7 @@ StatCache::~StatCache()
Clear();
pthread_mutex_destroy(&(StatCache::stat_cache_lock));
}else{
assert(false);
abort();
}
}

View File

@ -110,7 +110,8 @@ static string url_to_host(const std::string &url)
} else if (url.compare(0, https.size(), https) == 0) {
hostname = url.substr(https.size());
} else {
assert(!"url does not begin with http:// or https://");
S3FS_PRN_EXIT("url does not begin with http:// or https://");
abort();
}
size_t idx;

View File

@ -30,7 +30,6 @@
#include <syslog.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include <dirent.h>
#include <curl/curl.h>
#include <string>
@ -2000,7 +1999,7 @@ FdManager::FdManager()
S3FS_PRN_CRIT("failed to init mutex");
}
}else{
assert(false);
abort();
}
}
@ -2024,7 +2023,7 @@ FdManager::~FdManager()
FdManager::is_lock_init = false;
}
}else{
assert(false);
abort();
}
}