Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-04-06 12:10:19 +0300
committerJacques Lucke <jacques@blender.org>2020-04-06 12:10:19 +0300
commit43f895a59247ea4058cb3f019cd4dabd9ad9b0e4 (patch)
tree51469fde8affa6b20f67d12a4602c5f109c1a204 /source/blender/blenlib
parent52606afaa60462db45e783607255f56c06fd8d73 (diff)
parent480ff89bf7cfb1f9ffd5ce66fbd5c65288ef04c0 (diff)
Merge branch 'master' into functions
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_compiler_typecheck.h2
-rw-r--r--source/blender/blenlib/BLI_link_utils.h2
-rw-r--r--source/blender/blenlib/BLI_string_map.h9
-rw-r--r--source/blender/blenlib/intern/array_store.c18
-rw-r--r--source/blender/blenlib/intern/delaunay_2d.c14
-rw-r--r--source/blender/blenlib/intern/threads.c6
6 files changed, 21 insertions, 30 deletions
diff --git a/source/blender/blenlib/BLI_compiler_typecheck.h b/source/blender/blenlib/BLI_compiler_typecheck.h
index 958ffeb0748..0a2eddc4ecc 100644
--- a/source/blender/blenlib/BLI_compiler_typecheck.h
+++ b/source/blender/blenlib/BLI_compiler_typecheck.h
@@ -24,6 +24,8 @@
* These depend on compiler extensions and c11 in some cases.
*/
+#include "BLI_utildefines_variadic.h"
+
/* Causes warning:
* incompatible types when assigning to type 'Foo' from type 'Bar'
* ... the compiler optimizes away the temp var */
diff --git a/source/blender/blenlib/BLI_link_utils.h b/source/blender/blenlib/BLI_link_utils.h
index f37841e3192..c0db53ca9a3 100644
--- a/source/blender/blenlib/BLI_link_utils.h
+++ b/source/blender/blenlib/BLI_link_utils.h
@@ -61,7 +61,7 @@
#define BLI_LINKS_FREE(list) \
{ \
while (list) { \
- void *next = list->next; \
+ void *next = (list)->next; \
MEM_freeN(list); \
list = next; \
} \
diff --git a/source/blender/blenlib/BLI_string_map.h b/source/blender/blenlib/BLI_string_map.h
index d83ae31f08a..1402fdf8a03 100644
--- a/source/blender/blenlib/BLI_string_map.h
+++ b/source/blender/blenlib/BLI_string_map.h
@@ -450,15 +450,6 @@ template<typename T, typename Allocator = GuardedAllocator> class StringMap {
}
ITER_SLOTS_END(offset);
}
-
- template<typename ForwardT> void add__impl(StringRef key, ForwardT &&value)
- {
- this->ensure_can_add();
- uint32_t hash = this->compute_string_hash(key);
- ITER_SLOTS_BEGIN (hash, m_array, , item, offset) {
- }
- ITER_SLOTS_END(offset);
- }
};
#undef ITER_SLOTS_BEGIN
diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c
index c87dbee0f0e..85fbe7ece0f 100644
--- a/source/blender/blenlib/intern/array_store.c
+++ b/source/blender/blenlib/intern/array_store.c
@@ -406,7 +406,7 @@ static void bchunk_list_decref(BArrayMemory *bs_mem, BChunkList *chunk_list)
static size_t bchunk_list_data_check(const BChunkList *chunk_list, const uchar *data)
{
size_t offset = 0;
- for (BChunkRef *cref = chunk_list->chunk_refs.first; cref; cref = cref->next) {
+ LISTBASE_FOREACH (BChunkRef *, cref, &chunk_list->chunk_refs) {
if (memcmp(&data[offset], cref->link->data, cref->link->data_len) != 0) {
return false;
}
@@ -1511,7 +1511,7 @@ void BLI_array_store_clear(BArrayStore *bs)
size_t BLI_array_store_calc_size_expanded_get(const BArrayStore *bs)
{
size_t size_accum = 0;
- for (const BArrayState *state = bs->states.first; state; state = state->next) {
+ LISTBASE_FOREACH (const BArrayState *, state, &bs->states) {
size_accum += state->chunk_list->total_size;
}
return size_accum;
@@ -1632,14 +1632,14 @@ void BLI_array_store_state_data_get(BArrayState *state, void *data)
{
#ifdef USE_PARANOID_CHECKS
size_t data_test_len = 0;
- for (BChunkRef *cref = state->chunk_list->chunk_refs.first; cref; cref = cref->next) {
+ LISTBASE_FOREACH (BChunkRef *, cref, &state->chunk_list->chunk_refs) {
data_test_len += cref->link->data_len;
}
BLI_assert(data_test_len == state->chunk_list->total_size);
#endif
uchar *data_step = (uchar *)data;
- for (BChunkRef *cref = state->chunk_list->chunk_refs.first; cref; cref = cref->next) {
+ LISTBASE_FOREACH (BChunkRef *, cref, &state->chunk_list->chunk_refs) {
BLI_assert(cref->link->users > 0);
memcpy(data_step, cref->link->data, cref->link->data_len);
data_step += cref->link->data_len;
@@ -1666,7 +1666,7 @@ void *BLI_array_store_state_data_get_alloc(BArrayState *state, size_t *r_data_le
static size_t bchunk_list_size(const BChunkList *chunk_list)
{
size_t total_size = 0;
- for (BChunkRef *cref = chunk_list->chunk_refs.first; cref; cref = cref->next) {
+ LISTBASE_FOREACH (BChunkRef *, cref, &chunk_list->chunk_refs) {
total_size += cref->link->data_len;
}
return total_size;
@@ -1679,7 +1679,7 @@ bool BLI_array_store_is_valid(BArrayStore *bs)
/* Check Length
* ------------ */
- for (BArrayState *state = bs->states.first; state; state = state->next) {
+ LISTBASE_FOREACH (BArrayState *, state, &bs->states) {
BChunkList *chunk_list = state->chunk_list;
if (!(bchunk_list_size(chunk_list) == chunk_list->total_size)) {
return false;
@@ -1692,7 +1692,7 @@ bool BLI_array_store_is_valid(BArrayStore *bs)
#ifdef USE_MERGE_CHUNKS
/* ensure we merge all chunks that could be merged */
if (chunk_list->total_size > bs->info.chunk_byte_size_min) {
- for (BChunkRef *cref = chunk_list->chunk_refs.first; cref; cref = cref->next) {
+ LISTBASE_FOREACH (BChunkRef *, cref, &chunk_list->chunk_refs) {
if (cref->link->data_len < bs->info.chunk_byte_size_min) {
return false;
}
@@ -1734,7 +1734,7 @@ bool BLI_array_store_is_valid(BArrayStore *bs)
GHash *chunk_map = BLI_ghash_ptr_new(__func__);
int totrefs = 0;
- for (BArrayState *state = bs->states.first; state; state = state->next) {
+ LISTBASE_FOREACH (BArrayState *, state, &bs->states) {
GHASH_PTR_ADD_USER(chunk_list_map, state->chunk_list);
}
GHASH_ITER (gh_iter, chunk_list_map) {
@@ -1753,7 +1753,7 @@ bool BLI_array_store_is_valid(BArrayStore *bs)
/* count chunk's */
GHASH_ITER (gh_iter, chunk_list_map) {
const struct BChunkList *chunk_list = BLI_ghashIterator_getKey(&gh_iter);
- for (const BChunkRef *cref = chunk_list->chunk_refs.first; cref; cref = cref->next) {
+ LISTBASE_FOREACH (const BChunkRef *, cref, &chunk_list->chunk_refs) {
GHASH_PTR_ADD_USER(chunk_map, cref->link);
totrefs += 1;
}
diff --git a/source/blender/blenlib/intern/delaunay_2d.c b/source/blender/blenlib/intern/delaunay_2d.c
index 201c8a66d1a..836292e0c88 100644
--- a/source/blender/blenlib/intern/delaunay_2d.c
+++ b/source/blender/blenlib/intern/delaunay_2d.c
@@ -1992,25 +1992,25 @@ typedef struct EdgeVertLambda {
/* For sorting first by edge id, then by lambda, then by vert id. */
static int evl_cmp(const void *a, const void *b)
{
- const EdgeVertLambda *sa = a;
+ const EdgeVertLambda *area = a;
const EdgeVertLambda *sb = b;
- if (sa->e_id < sb->e_id) {
+ if (area->e_id < sb->e_id) {
return -1;
}
- else if (sa->e_id > sb->e_id) {
+ else if (area->e_id > sb->e_id) {
return 1;
}
- else if (sa->lambda < sb->lambda) {
+ else if (area->lambda < sb->lambda) {
return -1;
}
- else if (sa->lambda > sb->lambda) {
+ else if (area->lambda > sb->lambda) {
return 1;
}
- else if (sa->v_id < sb->v_id) {
+ else if (area->v_id < sb->v_id) {
return -1;
}
- else if (sa->v_id > sb->v_id) {
+ else if (area->v_id > sb->v_id) {
return 1;
}
return 0;
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index 0a574ea34ca..31e8581590a 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -93,11 +93,9 @@ static TaskScheduler *task_scheduler = NULL;
* for (go over all jobs)
* if (job is ready) {
* if (job was not removed) {
- * BLI_threadpool_remove(&lb, job);
- * }
+ * BLI_threadpool_remove(&lb, job); * }
* }
- * else cont = 1;
- * }
+ * else cont = 1; * }
* // conditions to exit loop
* if (if escape loop event) {
* if (BLI_available_threadslots(&lb) == maxthreads) {