Simplify array size calculation 55/186255/3
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 8 Aug 2018 09:27:10 +0000 (11:27 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Wed, 29 Aug 2018 08:34:05 +0000 (08:34 +0000)
Change-Id: I8d5af79702a1b4b2e61813b99a246fbbac559320

src/common/privilege_db.cpp

index 8599204e13b627f93b76cdc5b5be321decc69fa7..530fafbed86a7deb167c9f62e92872e1fa47b180 100644 (file)
 namespace SecurityManager {
 namespace {
 
-namespace detail {
 template <class T, size_t S>
-uint8_t(&arraySizeHelper(T (&)[S]))[S];
-
-template <class T, size_t S>
-uint8_t(&arraySizeHelper(std::array<T, S> const &))[S];
-} //namespace detail
-
-#define arraySize(A) (sizeof(detail::arraySizeHelper((A))))
+constexpr size_t arraySize(T (&)[S])
+{
+    return S;
+}
 
 constexpr const char *g_queries[StmtTypeCount] = {
     [int(StmtType::EAddApplication)] = "INSERT INTO user_app_pkg_view (app_name, pkg_name, uid, version, author_name, is_hybrid)"