Cleanup: Use LISTBASE_FOREACH macro
This commit is contained in:
parent
05ef031f37
commit
cec22ba8db
|
@ -168,10 +168,9 @@ bNodeTree *ED_node_tree_get(SpaceNode *snode, int level)
|
|||
|
||||
int ED_node_tree_path_length(SpaceNode *snode)
|
||||
{
|
||||
bNodeTreePath *path;
|
||||
int length = 0;
|
||||
int i;
|
||||
for (path = snode->treepath.first, i = 0; path; path = path->next, i++) {
|
||||
int i = 0;
|
||||
LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
|
||||
length += strlen(path->node_name);
|
||||
if (i > 0) {
|
||||
length += 1; /* for separator char */
|
||||
|
@ -182,11 +181,10 @@ int ED_node_tree_path_length(SpaceNode *snode)
|
|||
|
||||
void ED_node_tree_path_get(SpaceNode *snode, char *value)
|
||||
{
|
||||
bNodeTreePath *path;
|
||||
int i;
|
||||
int i = 0;
|
||||
|
||||
value[0] = '\0';
|
||||
for (path = snode->treepath.first, i = 0; path; path = path->next, i++) {
|
||||
LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
|
||||
if (i == 0) {
|
||||
strcpy(value, path->node_name);
|
||||
value += strlen(path->node_name);
|
||||
|
@ -200,11 +198,11 @@ void ED_node_tree_path_get(SpaceNode *snode, char *value)
|
|||
|
||||
void ED_node_tree_path_get_fixedbuf(SpaceNode *snode, char *value, int max_length)
|
||||
{
|
||||
bNodeTreePath *path;
|
||||
int size, i;
|
||||
int size;
|
||||
|
||||
value[0] = '\0';
|
||||
for (path = snode->treepath.first, i = 0; path; path = path->next, i++) {
|
||||
int i = 0;
|
||||
LISTBASE_FOREACH_INDEX (bNodeTreePath *, path, &snode->treepath, i) {
|
||||
if (i == 0) {
|
||||
size = BLI_strncpy_rlen(value, path->node_name, max_length);
|
||||
}
|
||||
|
@ -319,10 +317,8 @@ static SpaceLink *node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(s
|
|||
static void node_free(SpaceLink *sl)
|
||||
{
|
||||
SpaceNode *snode = (SpaceNode *)sl;
|
||||
bNodeTreePath *path, *path_next;
|
||||
|
||||
for (path = snode->treepath.first; path; path = path_next) {
|
||||
path_next = path->next;
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeTreePath *, path, &snode->treepath) {
|
||||
MEM_freeN(path);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue