Cleanup: use braces in headers

This commit is contained in:
Campbell Barton
2023-09-24 14:52:38 +10:00
parent d1d570d318
commit 2721b937fb
63 changed files with 605 additions and 308 deletions

View File

@@ -47,8 +47,9 @@ template<typename _Tp> struct MEM_Allocator {
_Tp *allocate(size_type __n, const void * = 0)
{
_Tp *__ret = NULL;
if (__n)
if (__n) {
__ret = static_cast<_Tp *>(MEM_mallocN(__n * sizeof(_Tp), "STL MEM_Allocator"));
}
return __ret;
}

View File

@@ -196,8 +196,9 @@ template<class T> class MEM_CacheLimiter {
while (!queue.empty() && mem_in_use > max) {
MEM_CacheElementPtr elem = get_least_priority_destroyable_element();
if (!elem)
if (!elem) {
break;
}
if (data_size_func) {
cur_size = data_size_func(elem->get()->get_data());
@@ -255,24 +256,27 @@ template<class T> class MEM_CacheLimiter {
return false;
}
if (item_destroyable_func) {
if (!item_destroyable_func(elem->get()->get_data()))
if (!item_destroyable_func(elem->get()->get_data())) {
return false;
}
}
return true;
}
MEM_CacheElementPtr get_least_priority_destroyable_element(void)
{
if (queue.empty())
if (queue.empty()) {
return NULL;
}
MEM_CacheElementPtr best_match_elem = NULL;
if (!item_priority_func) {
for (iterator it = queue.begin(); it != queue.end(); it++) {
MEM_CacheElementPtr elem = *it;
if (!can_destroy_element(elem))
if (!can_destroy_element(elem)) {
continue;
}
best_match_elem = elem;
break;
}
@@ -284,8 +288,9 @@ template<class T> class MEM_CacheLimiter {
for (i = 0; i < queue.size(); i++) {
MEM_CacheElementPtr elem = queue[i];
if (!can_destroy_element(elem))
if (!can_destroy_element(elem)) {
continue;
}
/* By default 0 means highest priority element. */
/* Casting a size type to int is questionable,