Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
3d5be386
...
3d5be3869b3a6761b38084af1135bb0883e6172f
authored
2002-11-15 14:35:30 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(list_replace): New function.
1 parent
b54042f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletions
include/mailutils/list.h
mailbox/list.c
include/mailutils/list.h
View file @
3d5be38
...
...
@@ -31,6 +31,7 @@ extern int list_prepend __P ((list_t, void *item));
extern
int
list_is_empty
__P
((
list_t
));
extern
int
list_count
__P
((
list_t
,
size_t
*
pcount
));
extern
int
list_remove
__P
((
list_t
,
void
*
item
));
extern
int
list_replace
__P
((
list_t
list
,
void
*
old_item
,
void
*
new_item
));
extern
int
list_get
__P
((
list_t
,
size_t
_index
,
void
**
pitem
));
typedef
int
list_action_t
__PMT
((
void
*
item
,
void
*
cbdata
));
...
...
mailbox/list.c
View file @
3d5be38
...
...
@@ -151,7 +151,29 @@ list_remove (list_t list, void *item)
}
}
monitor_unlock
(
list
->
monitor
);
return
ENOENT
;
return
status
;
}
int
list_replace
(
list_t
list
,
void
*
old_item
,
void
*
new_item
)
{
struct
list_data
*
current
,
*
previous
;
int
status
=
ENOENT
;
if
(
list
==
NULL
)
return
EINVAL
;
monitor_wrlock
(
list
->
monitor
);
for
(
previous
=
&
(
list
->
head
),
current
=
list
->
head
.
next
;
current
!=
&
(
list
->
head
);
previous
=
current
,
current
=
current
->
next
)
{
if
(
current
->
item
==
old_item
)
{
current
->
item
=
new_item
;
status
=
0
;
break
;
}
}
monitor_unlock
(
list
->
monitor
);
return
status
;
}
/* FIXME: FIXME: FIXME: URGENT:
...
...
Please
register
or
sign in
to post a comment