Skip to content

list: added list_item_del_init - #303

Merged
lgirdwood merged 1 commit into
thesofproject:masterfrom
dabekjakub:list_delete
Sep 3, 2018
Merged

lgirdwood merged 1 commit into
thesofproject:masterfrom
dabekjakub:list_delete

Conversation

@dabekjakub

Copy link
Copy Markdown
Member

Added function that will delete and reinitialize list.

Reinitialized lists show up as empty unlike deleted with
list_item_del.

Signed-off-by: Jakub Dabek jakub.dabek@linux.intel.com

Added function that will delete and reinitialize list.

Reinitialized lists show up as empty unlike deleted with
list_item_del.

Signed-off-by: Jakub Dabek <jakub.dabek@linux.intel.com>
@jajanusz

jajanusz commented Sep 3, 2018

Copy link
Copy Markdown
Contributor

#300

@lgirdwood
lgirdwood merged commit 4c0b1d4 into thesofproject:master Sep 3, 2018
@lgirdwood

Copy link
Copy Markdown
Member

@dabekjakub can you send PR for stable-1.2 too

Comment thread src/include/sof/list.h
static inline void list_item_del_init(struct list_item *item)
{
list_item_del(item);
list_init(item);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you init only the item not the list.
What do you mean by

and list_is_empty will return true

@jajanusz jajanusz Sep 4, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you init only the item not the list.

Item and list are interchangable, depends on how you use it

and list_is_empty will return true

When you just del item it still has pointers pointing to items in list it's not part of. When you init item it's just like newly created item that is not part of any list and will return true for list_is_empty - it doesn't check for null it next but if next == 'this item'

@xiulipan

xiulipan commented Sep 6, 2018

Copy link
Copy Markdown
Contributor

@lgirdwood @dabekjakub
Why don't just add list_init(item);
to all list_item_del to make sure all del is safe?

@lgirdwood

Copy link
Copy Markdown
Member

@xiulipan pls send a PR

@xiulipan

xiulipan commented Sep 6, 2018

Copy link
Copy Markdown
Contributor

@lgirdwood
Reuse #300 and make the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants