4d4c0c47811a5c33fec75e98a44fc185f09941d4 hiram Thu Nov 21 13:57:01 2013 -0800 there is a macro INLINE for static inline refs #12189 diff --git src/lib/elmTree.c src/lib/elmTree.c index 950f024..041060a 100644 --- src/lib/elmTree.c +++ src/lib/elmTree.c @@ -21,31 +21,31 @@ // Returns a new node to attach to a tree. { assert((*tree != NULL && content != NULL) || (*tree == NULL && content == NULL)); struct elmNode *node; lmAllocVar(lm,node); if (tree != NULL) // Keep all nodes in a simple slList slAddHead(tree,node); node->selfAndDescendants = 1; node->content = content; return node; } // NOTE the root of the tree always has NULL content. #define treePlant(lm,tree) treeNewNode(lm,tree,NULL) -static inline void treeSprout(struct elmNode *parent,struct elmNode *node) +INLINE void treeSprout(struct elmNode *parent,struct elmNode *node) // Adds a leaf or branch node to an existing tree node. { node->parent = parent; node->sibling = parent->firstChild; parent->firstChild = node; parent->selfAndDescendants += node->selfAndDescendants; } struct elmNode *treeClip(struct elmNode *node) // Clips leaf or branch node from a tree returning the node's former parent { assert(node->parent != NULL); struct elmNode *parent = node->parent; node->parent = NULL; @@ -59,31 +59,31 @@ if (child == node) { child->sibling = NULL; if (prevChild != NULL) prevChild->sibling = nextChild; else parent->firstChild = nextChild; break; } } parent->selfAndDescendants -= node->selfAndDescendants; return parent; } -static inline void treeBranchBefore(struct elmNode *branch,struct elmNode *node) +INLINE void treeBranchBefore(struct elmNode *branch,struct elmNode *node) // Adds a new 'branch' node just before the current 'node' { struct elmNode *parent = treeClip(node); treeSprout(parent,branch); treeSprout(branch,node); } enum elmNodeOverlap rTreeBranchFindMaxWeight(struct elmNode *branch, struct slList *element, elmNodeCompareFunction *neighborCmp, int *pWeight, void *extra) // Using the compare routine, the max weight is found an element and a candidate branch { int bestWeight = 0; int topNodeResult = neighborCmp(branch->content,element,&bestWeight,extra); if (topNodeResult != enoEqual && topNodeResult != enoSuperset // could do better