mirror of
https://github.com/drasko/codezero.git
synced 2026-01-29 19:23:14 +01:00
Fixed minor issues on capability list sharing.
This commit is contained in:
@@ -55,7 +55,12 @@ static inline void cap_list_remove(struct capability *cap,
|
||||
static inline struct capability *
|
||||
cap_list_detach(struct cap_list *clist)
|
||||
{
|
||||
struct link *list = list_detach(&clist->caps);
|
||||
struct link *list;
|
||||
|
||||
if (!clist->ncaps)
|
||||
return 0;
|
||||
|
||||
list = list_detach(&clist->caps);
|
||||
clist->ncaps = 0;
|
||||
return link_to_struct(list, struct capability, list);
|
||||
}
|
||||
@@ -75,6 +80,9 @@ static inline void cap_list_attach(struct capability *cap,
|
||||
static inline void cap_list_move(struct cap_list *to,
|
||||
struct cap_list *from)
|
||||
{
|
||||
if (!from->ncaps)
|
||||
return;
|
||||
|
||||
struct capability *cap_head = cap_list_detach(from);
|
||||
cap_list_attach(cap_head, to);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user