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:
-rw-r--r--source/blender/blenfont/intern/blf_font.c4
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c8
-rw-r--r--source/blender/blenkernel/intern/blender.c4
-rw-r--r--source/blender/blenkernel/intern/context.c3
-rw-r--r--source/blender/blenkernel/intern/displist.c5
-rw-r--r--source/blender/blenkernel/intern/group.c4
-rw-r--r--source/blender/blenkernel/intern/image.c7
-rw-r--r--source/blender/blenkernel/intern/key.c22
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/object.c16
-rw-r--r--source/blender/blenkernel/intern/pointcache.c6
-rw-r--r--source/blender/blenkernel/intern/property.c5
-rw-r--r--source/blender/blenkernel/intern/sca.c12
-rw-r--r--source/blender/blenkernel/intern/sequencer.c3
-rw-r--r--source/blender/blenlib/BLI_ghash.h2
-rw-r--r--source/blender/blenlib/BLI_listbase.h2
-rw-r--r--source/blender/blenlib/intern/BLI_ghash.c2
-rw-r--r--source/blender/blenlib/intern/BLI_mempool.c7
-rw-r--r--source/blender/blenlib/intern/listbase.c24
-rw-r--r--source/blender/blenloader/intern/undofile.c6
-rw-r--r--source/blender/blenloader/intern/versioning_legacy.c5
-rw-r--r--source/blender/bmesh/intern/bmesh_edgeloop.c3
-rw-r--r--source/blender/editors/curve/editcurve.c2
-rw-r--r--source/blender/editors/interface/interface.c6
-rw-r--r--source/blender/editors/metaball/mball_edit.c10
-rw-r--r--source/blender/editors/space_graph/graph_select.c9
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c4
-rw-r--r--source/blender/windowmanager/intern/wm.c12
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c17
29 files changed, 85 insertions, 127 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 15098d50531..1e604bd8107 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -524,9 +524,7 @@ void blf_font_free(FontBLF *font)
GlyphCacheBLF *gc;
font->glyph_cache = NULL;
- while (font->cache.first) {
- gc = font->cache.first;
- BLI_remlink(&font->cache, gc);
+ while ((gc = BLI_pophead(&font->cache))) {
blf_glyph_cache_free(gc);
}
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 37e874fa396..ae8e2d17c54 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -128,9 +128,7 @@ void blf_glyph_cache_clear(FontBLF *font)
for (gc = font->cache.first; gc; gc = gc->next) {
for (i = 0; i < 257; i++) {
- while (gc->bucket[i].first) {
- g = gc->bucket[i].first;
- BLI_remlink(&(gc->bucket[i]), g);
+ while ((g = BLI_pophead(&gc->bucket[i]))) {
blf_glyph_free(g);
}
}
@@ -145,9 +143,7 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc)
int i;
for (i = 0; i < 257; i++) {
- while (gc->bucket[i].first) {
- g = gc->bucket[i].first;
- BLI_remlink(&(gc->bucket[i]), g);
+ while ((g = BLI_pophead(&gc->bucket[i]))) {
blf_glyph_free(g);
}
}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 26f481e5341..3fbdba351b0 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -924,9 +924,7 @@ int BKE_copybuffer_save(const char *filename, ReportList *reports)
ID *id;
ListBase *lb1 = lbarray[a], *lb2 = fromarray[a];
- while (lb2->first) {
- id = lb2->first;
- BLI_remlink(lb2, id);
+ while ((id = BLI_pophead(lb2))) {
BLI_addtail(lb1, id);
id_sort_by_name(lb1, id);
}
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 622b4f6df5a..2eb763831e4 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -198,8 +198,7 @@ void CTX_store_free_list(ListBase *contexts)
{
bContextStore *ctx;
- while ((ctx = contexts->first)) {
- BLI_remlink(contexts, ctx);
+ while ((ctx = BLI_pophead(contexts))) {
CTX_store_free(ctx);
}
}
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 5fa62c22a34..77ec333c173 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -81,11 +81,8 @@ void BKE_displist_free(ListBase *lb)
{
DispList *dl;
- dl = lb->first;
- while (dl) {
- BLI_remlink(lb, dl);
+ while ((dl = BLI_pophead(lb))) {
BKE_displist_elem_free(dl);
- dl = lb->first;
}
}
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index ad0aed4691a..a5cbf064bc2 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -65,9 +65,7 @@ void BKE_group_free(Group *group)
/* don't free group itself */
GroupObject *go;
- while (group->gobject.first) {
- go = group->gobject.first;
- BLI_remlink(&group->gobject, go);
+ while ((go = BLI_pophead(&group->gobject))) {
free_group_object(go);
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 86382c64ed3..37dacd1a328 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -195,9 +195,7 @@ static void image_free_buffers(Image *ima)
{
ImBuf *ibuf;
- while ((ibuf = ima->ibufs.first)) {
- BLI_remlink(&ima->ibufs, ibuf);
-
+ while ((ibuf = BLI_pophead(&ima->ibufs))) {
if (ibuf->userdata) {
MEM_freeN(ibuf->userdata);
ibuf->userdata = NULL;
@@ -524,8 +522,7 @@ void BKE_image_merge(Image *dest, Image *source)
/* sanity check */
if (dest && source && dest != source) {
- while ((ibuf = source->ibufs.first)) {
- BLI_remlink(&source->ibufs, ibuf);
+ while ((ibuf = BLI_pophead(&source->ibufs))) {
image_assign_ibuf(dest, ibuf, IMA_INDEX_PASS(ibuf->index), IMA_INDEX_FRAME(ibuf->index));
}
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index aaac17ac1ed..7b73dee73fc 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -85,29 +85,23 @@ void BKE_key_free(Key *key)
KeyBlock *kb;
BKE_free_animdata((ID *)key);
-
- while ( (kb = key->block.first) ) {
-
- if (kb->data) MEM_freeN(kb->data);
-
- BLI_remlink(&key->block, kb);
+
+ while ((kb = BLI_pophead(&key->block))) {
+ if (kb->data)
+ MEM_freeN(kb->data);
MEM_freeN(kb);
}
-
}
void BKE_key_free_nolib(Key *key)
{
KeyBlock *kb;
-
- while ( (kb = key->block.first) ) {
-
- if (kb->data) MEM_freeN(kb->data);
-
- BLI_remlink(&key->block, kb);
+
+ while ((kb = BLI_pophead(&key->block))) {
+ if (kb->data)
+ MEM_freeN(kb->data);
MEM_freeN(kb);
}
-
}
Key *BKE_key_add(ID *id) /* common function */
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 1349c4dc8d4..ee5b11d3beb 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -2666,7 +2666,7 @@ void BKE_node_instance_hash_clear(bNodeInstanceHash *hash, bNodeInstanceValueFP
void *BKE_node_instance_hash_pop(bNodeInstanceHash *hash, bNodeInstanceKey key)
{
- return BLI_ghash_pop(hash->ghash, &key, NULL);
+ return BLI_ghash_popkey(hash->ghash, &key, NULL);
}
int BKE_node_instance_hash_haskey(bNodeInstanceHash *hash, bNodeInstanceKey key)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 8f64ce6bef7..d54ccb17710 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -142,11 +142,9 @@ void BKE_object_update_base_layer(struct Scene *scene, Object *ob)
void BKE_object_free_particlesystems(Object *ob)
{
- while (ob->particlesystem.first) {
- ParticleSystem *psys = ob->particlesystem.first;
-
- BLI_remlink(&ob->particlesystem, psys);
-
+ ParticleSystem *psys;
+
+ while ((psys = BLI_pophead(&ob->particlesystem))) {
psys_free(ob, psys);
}
}
@@ -182,11 +180,9 @@ void BKE_object_free_curve_cache(Object *ob)
void BKE_object_free_modifiers(Object *ob)
{
- while (ob->modifiers.first) {
- ModifierData *md = ob->modifiers.first;
-
- BLI_remlink(&ob->modifiers, md);
-
+ ModifierData *md;
+
+ while ((md = BLI_pophead(&ob->modifiers))) {
modifier_free(md);
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 93f6965e97b..2e08e0587ac 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2969,12 +2969,10 @@ void BKE_ptcache_free(PointCache *cache)
}
void BKE_ptcache_free_list(ListBase *ptcaches)
{
- PointCache *cache = ptcaches->first;
+ PointCache *cache;
- while (cache) {
- BLI_remlink(ptcaches, cache);
+ while ((cache = BLI_pophead(ptcaches))) {
BKE_ptcache_free(cache);
- cache = ptcaches->first;
}
}
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index 73f2a864e32..bb04d548a44 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -59,9 +59,8 @@ void BKE_bproperty_free(bProperty *prop)
void BKE_bproperty_free_list(ListBase *lb)
{
bProperty *prop;
-
- while ( (prop = lb->first) ) {
- BLI_remlink(lb, prop);
+
+ while ((prop = BLI_pophead(lb))) {
BKE_bproperty_free(prop);
}
}
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index 92f57a54a01..091b5f337c6 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -63,8 +63,7 @@ void free_sensors(ListBase *lb)
{
bSensor *sens;
- while ((sens= lb->first)) {
- BLI_remlink(lb, sens);
+ while ((sens = BLI_pophead(lb))) {
free_sensor(sens);
}
}
@@ -227,9 +226,9 @@ void free_controllers(ListBase *lb)
{
bController *cont;
- while ((cont= lb->first)) {
- BLI_remlink(lb, cont);
- if (cont->slinks) MEM_freeN(cont->slinks);
+ while ((cont = BLI_pophead(lb))) {
+ if (cont->slinks)
+ MEM_freeN(cont->slinks);
free_controller(cont);
}
}
@@ -346,8 +345,7 @@ void free_actuators(ListBase *lb)
{
bActuator *act;
- while ((act= lb->first)) {
- BLI_remlink(lb, act);
+ while ((act = BLI_pophead(lb))) {
free_actuator(act);
}
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 8840e08c2a1..a43f6dbf645 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -865,8 +865,7 @@ void BKE_sequencer_sort(Scene *scene)
seqbase.first = seqbase.last = NULL;
effbase.first = effbase.last = NULL;
- while ( (seq = ed->seqbasep->first) ) {
- BLI_remlink(ed->seqbasep, seq);
+ while ((seq = BLI_pophead(ed->seqbasep))) {
if (seq->type & SEQ_TYPE_EFFECT) {
seqt = effbase.first;
diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h
index 0aef78cd3fc..8ce6ba0d2a2 100644
--- a/source/blender/blenlib/BLI_ghash.h
+++ b/source/blender/blenlib/BLI_ghash.h
@@ -70,7 +70,7 @@ bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashVal
void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
void BLI_ghash_clear_ex(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp,
const unsigned int nentries_reserve);
-void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp);
+void *BLI_ghash_popkey(GHash *gh, void *key, GHashKeyFreeFP keyfreefp);
bool BLI_ghash_haskey(GHash *gh, const void *key);
int BLI_ghash_size(GHash *gh);
void BLI_ghash_flag_set(GHash *gh, unsigned int flag);
diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h
index 4c7ddf7ba66..0648c0ed06d 100644
--- a/source/blender/blenlib/BLI_listbase.h
+++ b/source/blender/blenlib/BLI_listbase.h
@@ -60,6 +60,8 @@ void BLI_freelistN(struct ListBase *listbase);
void BLI_addtail(struct ListBase *listbase, void *vlink);
void BLI_remlink(struct ListBase *listbase, void *vlink);
bool BLI_remlink_safe(struct ListBase *listbase, void *vlink);
+void *BLI_pophead(ListBase *listbase);
+void *BLI_poptail(ListBase *listbase);
void BLI_addhead(struct ListBase *listbase, void *vlink);
void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink);
diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c
index dc9d4db7e8a..9c8231a473b 100644
--- a/source/blender/blenlib/intern/BLI_ghash.c
+++ b/source/blender/blenlib/intern/BLI_ghash.c
@@ -438,7 +438,7 @@ bool BLI_ghash_remove(GHash *gh, void *key, GHashKeyFreeFP keyfreefp, GHashValFr
* \param keyfreefp Optional callback to free the key.
* \return the value of \a key int \a gh or NULL.
*/
-void *BLI_ghash_pop(GHash *gh, void *key, GHashKeyFreeFP keyfreefp)
+void *BLI_ghash_popkey(GHash *gh, void *key, GHashKeyFreeFP keyfreefp)
{
const unsigned int hash = ghash_keyhash(gh, key);
Entry *e = ghash_remove_ex(gh, key, keyfreefp, NULL, hash);
diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c
index 1c3c1cd8d7a..75bbd99b91f 100644
--- a/source/blender/blenlib/intern/BLI_mempool.c
+++ b/source/blender/blenlib/intern/BLI_mempool.c
@@ -340,9 +340,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
BLI_freenode *curnode = NULL;
char *tmpaddr = NULL;
int i;
- BLI_mempool_chunk *first = pool->chunks.first;
+ BLI_mempool_chunk *first;
- BLI_remlink(&pool->chunks, first);
+ first = BLI_pophead(&pool->chunks);
mempool_chunk_free_all(&pool->chunks, pool->flag);
BLI_addtail(&pool->chunks, first);
#ifdef USE_TOTALLOC
@@ -543,8 +543,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve)
chunks_temp = pool->chunks;
pool->chunks.first = pool->chunks.last = NULL;
- while ((mpchunk = chunks_temp.first)) {
- BLI_remlink(&chunks_temp, mpchunk);
+ while ((mpchunk = BLI_pophead(&chunks_temp))) {
lasttail = mempool_chunk_add(pool, mpchunk, lasttail);
}
}
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index ded4f31ae05..c4644ff6309 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -129,6 +129,30 @@ bool BLI_remlink_safe(ListBase *listbase, void *vlink)
}
}
+/**
+ * Removes the head from \a listbase and returns it.
+ */
+void *BLI_pophead(ListBase *listbase)
+{
+ Link *link;
+ if ((link = listbase->first)) {
+ BLI_remlink(listbase, link);
+ }
+ return link;
+}
+
+
+/**
+ * Removes the tail from \a listbase and returns it.
+ */
+void *BLI_poptail(ListBase *listbase)
+{
+ Link *link;
+ if ((link = listbase->last)) {
+ BLI_remlink(listbase, link);
+ }
+ return link;
+}
/**
* Removes \a vlink from listbase and disposes of it. Assumes it is linked into there!
diff --git a/source/blender/blenloader/intern/undofile.c b/source/blender/blenloader/intern/undofile.c
index 2b63d13a9dd..12f4a295a34 100644
--- a/source/blender/blenloader/intern/undofile.c
+++ b/source/blender/blenloader/intern/undofile.c
@@ -51,9 +51,9 @@ void BLO_free_memfile(MemFile *memfile)
{
MemFileChunk *chunk;
- while ( (chunk = (memfile->chunks.first) ) ) {
- if (chunk->ident == 0) MEM_freeN(chunk->buf);
- BLI_remlink(&memfile->chunks, chunk);
+ while ((chunk = BLI_pophead(&memfile->chunks))) {
+ if (chunk->ident == 0)
+ MEM_freeN(chunk->buf);
MEM_freeN(chunk);
}
memfile->size = 0;
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index 82040020ce4..dad132f45df 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -518,11 +518,8 @@ static void do_version_free_effects_245(ListBase *lb)
{
Effect *eff;
- eff = lb->first;
- while (eff) {
- BLI_remlink(lb, eff);
+ while ((eff = BLI_pophead(lb))) {
do_version_free_effect_245(eff);
- eff = lb->first;
}
}
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c
index 1f052bd206a..6b306e82bb0 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.c
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.c
@@ -361,8 +361,7 @@ bool BM_mesh_edgeloops_find_path(BMesh *bm, ListBase *r_eloops,
void BM_mesh_edgeloops_free(ListBase *eloops)
{
BMEdgeLoopStore *el_store;
- while ((el_store = eloops->first)) {
- BLI_remlink(eloops, el_store);
+ while ((el_store = BLI_pophead(eloops))) {
BM_edgeloop_free(el_store);
}
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 01559a007ef..be577a3644e 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -361,7 +361,7 @@ static CVKeyIndex *getCVKeyIndex(EditNurb *editnurb, void *cv)
static CVKeyIndex *popCVKeyIndex(EditNurb *editnurb, void *cv)
{
- return BLI_ghash_pop(editnurb->keyindex, cv, NULL);
+ return BLI_ghash_popkey(editnurb->keyindex, cv, NULL);
}
static BezTriple *getKeyIndexOrig_bezt(EditNurb *editnurb, BezTriple *bezt)
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 21a63183c1a..cca696bf5ca 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -2230,8 +2230,7 @@ void uiFreeBlock(const bContext *C, uiBlock *block)
{
uiBut *but;
- while ( (but = block->buttons.first) ) {
- BLI_remlink(&block->buttons, but);
+ while ((but = BLI_pophead(&block->buttons))) {
ui_free_but(C, but);
}
@@ -2255,8 +2254,7 @@ void uiFreeBlocks(const bContext *C, ListBase *lb)
{
uiBlock *block;
- while ( (block = lb->first) ) {
- BLI_remlink(lb, block);
+ while ((block = BLI_pophead(lb))) {
uiFreeBlock(C, block);
}
}
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index adffe16ca18..b79eeee49d7 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -501,19 +501,13 @@ bool mouse_mball(bContext *C, const int mval[2], bool extend, bool deselect, boo
/* free all MetaElems from ListBase */
static void freeMetaElemlist(ListBase *lb)
{
- MetaElem *ml, *next;
+ MetaElem *ml;
if (lb == NULL) return;
- ml = lb->first;
- while (ml) {
- next = ml->next;
- BLI_remlink(lb, ml);
+ while ((ml = BLI_pophead(lb))) {
MEM_freeN(ml);
- ml = next;
}
-
- lb->first = lb->last = NULL;
}
diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c
index cbec3072c44..aaaafa93bb0 100644
--- a/source/blender/editors/space_graph/graph_select.c
+++ b/source/blender/editors/space_graph/graph_select.c
@@ -1049,10 +1049,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
/* if list only has 1 item, remove it from the list and return */
if (matches->first == matches->last) {
/* need to remove from the list, otherwise it gets freed and then we can't return it */
- nvi = matches->first;
- BLI_remlink(matches, nvi);
-
- return nvi;
+ return BLI_pophead(matches);
}
/* try to find the first selected F-Curve vert, then take the one after it */
@@ -1075,9 +1072,7 @@ static tNearestVertInfo *get_best_nearest_fcurve_vert(ListBase *matches)
/* if we're still here, this means that we failed to find anything appropriate in the first pass,
* so just take the first item now...
*/
- nvi = matches->first;
- BLI_remlink(matches, nvi);
- return nvi;
+ return BLI_pophead(matches);
}
/* Find the nearest vertices (either a handle or the keyframe) that are nearest to the mouse cursor (in area coordinates)
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index e244c7cf57f..d7919125fee 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1039,9 +1039,7 @@ static void GPU_nodes_free(ListBase *nodes)
{
GPUNode *node;
- while (nodes->first) {
- node = nodes->first;
- BLI_remlink(nodes, node);
+ while ((node = BLI_pophead(nodes))) {
GPU_node_free(node);
}
}
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index a109c2cbd7b..74c066d1d86 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -156,8 +156,7 @@ void WM_operator_stack_clear(wmWindowManager *wm)
{
wmOperator *op;
- while ((op = wm->operators.first)) {
- BLI_remlink(&wm->operators, op);
+ while ((op = BLI_pophead(&wm->operators))) {
WM_operator_free(op);
}
@@ -414,20 +413,17 @@ void wm_close_and_free(bContext *C, wmWindowManager *wm)
if (wm->autosavetimer)
wm_autosave_timer_ended(wm);
- while ((win = wm->windows.first)) {
- BLI_remlink(&wm->windows, win);
+ while ((win = BLI_pophead(&wm->windows))) {
win->screen = NULL; /* prevent draw clear to use screen */
wm_draw_window_clear(win);
wm_window_free(C, wm, win);
}
- while ((op = wm->operators.first)) {
- BLI_remlink(&wm->operators, op);
+ while ((op = BLI_pophead(&wm->operators))) {
WM_operator_free(op);
}
- while ((keyconf = wm->keyconfigs.first)) {
- BLI_remlink(&wm->keyconfigs, keyconf);
+ while ((keyconf = BLI_pophead(&wm->keyconfigs))) {
WM_keyconfig_free(keyconf);
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 08432d62720..a74e7486e8b 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -127,8 +127,7 @@ void wm_event_free_all(wmWindow *win)
{
wmEvent *event;
- while ((event = win->queue.first)) {
- BLI_remlink(&win->queue, event);
+ while ((event = BLI_pophead(&win->queue))) {
wm_event_free(event);
}
}
@@ -233,14 +232,6 @@ static void wm_notifier_clear(wmNotifier *note)
memset(((char *)note) + sizeof(Link), 0, sizeof(*note) - sizeof(Link));
}
-static wmNotifier *wm_notifier_next(wmWindowManager *wm)
-{
- wmNotifier *note = wm->queue.first;
-
- if (note) BLI_remlink(&wm->queue, note);
- return note;
-}
-
/* called in mainloop */
void wm_event_do_notifiers(bContext *C)
{
@@ -316,7 +307,7 @@ void wm_event_do_notifiers(bContext *C)
}
/* the notifiers are sent without context, to keep it clean */
- while ( (note = wm_notifier_next(wm)) ) {
+ while ((note = BLI_pophead(&wm->queue))) {
for (win = wm->windows.first; win; win = win->next) {
/* filter out notifiers */
@@ -1331,9 +1322,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers)
wmWindowManager *wm = CTX_wm_manager(C);
/* C is zero on freeing database, modal handlers then already were freed */
- while ((handler = handlers->first)) {
- BLI_remlink(handlers, handler);
-
+ while ((handler = BLI_pophead(handlers))) {
if (handler->op) {
if (handler->op->type->cancel) {
ScrArea *area = CTX_wm_area(C);