151 |
} |
} |
152 |
} |
} |
153 |
monitor_unlock (list->monitor); |
monitor_unlock (list->monitor); |
154 |
return ENOENT; |
return status; |
155 |
|
} |
156 |
|
|
157 |
|
int |
158 |
|
list_replace (list_t list, void *old_item, void *new_item) |
159 |
|
{ |
160 |
|
struct list_data *current, *previous; |
161 |
|
int status = ENOENT; |
162 |
|
if (list == NULL) |
163 |
|
return EINVAL; |
164 |
|
monitor_wrlock (list->monitor); |
165 |
|
for (previous = &(list->head), current = list->head.next; |
166 |
|
current != &(list->head); previous = current, current = current->next) |
167 |
|
{ |
168 |
|
if (current->item == old_item) |
169 |
|
{ |
170 |
|
current->item = new_item; |
171 |
|
status = 0; |
172 |
|
break; |
173 |
|
} |
174 |
|
} |
175 |
|
monitor_unlock (list->monitor); |
176 |
|
return status; |
177 |
} |
} |
178 |
|
|
179 |
/* FIXME: FIXME: FIXME: URGENT: |
/* FIXME: FIXME: FIXME: URGENT: |