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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-22 19:20:06 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-06-22 19:20:06 +0400
commit30a7c6d2813dac7492b845adcffc2c129f3f8ba1 (patch)
tree28f78c48ba9d8a51b59836996851ce35f12b4150 /source/blender/blenlib/intern/BLI_linklist.c
parented28a0296fc98411da11243f20698be7f7f645cf (diff)
Merge a few small blenlib changes from the render25 branch:
* define for missing hypotf on msvc. * svd_m4 and pseudoinverse_m4_m4 functions. * small tweak to perlin noise, use static function instead of macro. * BLI_linklist_find and BLI_linklist_insert_after functions. * MALWAYS_INLINE define to force inlining.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_linklist.c')
-rw-r--r--source/blender/blenlib/intern/BLI_linklist.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/BLI_linklist.c b/source/blender/blenlib/intern/BLI_linklist.c
index afa4d273090..c903e66057e 100644
--- a/source/blender/blenlib/intern/BLI_linklist.c
+++ b/source/blender/blenlib/intern/BLI_linklist.c
@@ -45,18 +45,28 @@ int BLI_linklist_length(LinkNode *list) {
}
}
-int BLI_linklist_index(struct LinkNode *list, void *ptr)
+int BLI_linklist_index(LinkNode *list, void *ptr)
{
int index;
- for (index = 0; list; list= list->next, index++) {
+ for (index = 0; list; list= list->next, index++)
if (list->link == ptr)
return index;
- }
return -1;
}
+LinkNode *BLI_linklist_find(LinkNode *list, int index)
+{
+ int i;
+
+ for (i = 0; list; list= list->next, i++)
+ if (i == index)
+ return list;
+
+ return NULL;
+}
+
void BLI_linklist_reverse(LinkNode **listp) {
LinkNode *rhead= NULL, *cur= *listp;
@@ -105,6 +115,22 @@ void BLI_linklist_prepend_arena(LinkNode **listp, void *ptr, MemArena *ma) {
*listp= nlink;
}
+void BLI_linklist_insert_after(LinkNode **listp, void *ptr) {
+ LinkNode *nlink= MEM_mallocN(sizeof(*nlink), "nlink");
+ LinkNode *node = *listp;
+
+ nlink->link = ptr;
+
+ if(node) {
+ nlink->next = node->next;
+ node->next = nlink;
+ }
+ else {
+ nlink->next = NULL;
+ *listp = nlink;
+ }
+}
+
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc) {
while (list) {
LinkNode *next= list->next;