Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arne Øslebø
mapi
Commits
b4f3c8c1
Commit
b4f3c8c1
authored
Feb 10, 2006
by
Browse files
Add a search function (only for DiMAPI)
git-svn-id:
file:///home/svn/mapi/trunk@346
8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent
ce011ac2
Changes
2
Hide whitespace changes
Inline
Side-by-side
flist.c
View file @
b4f3c8c1
...
...
@@ -208,3 +208,23 @@ void flist_reverse(flist_t* list)
return
;
}
#ifdef DIMAPI
void
*
flist_search
(
flist_t
*
list
,
int
(
*
comp
)(
void
*
,
void
*
),
void
*
user
)
{
flist_node_t
*
n
;
void
*
dataCopy
;
//pthread_mutex_lock(&list->lock);
for
(
n
=
flist_head
(
list
)
;
n
!=
NULL
;
n
=
flist_next
(
n
))
{
if
(
comp
(
flist_data
(
n
),
user
)
==
0
)
{
dataCopy
=
flist_data
(
n
);
// pthread_mutex_unlock(&list->lock);
return
dataCopy
;
}
}
//pthread_mutex_unlock(&list->lock);
return
NULL
;
}
#endif
flist.h
View file @
b4f3c8c1
...
...
@@ -118,4 +118,18 @@ extern inline void* flist_get(flist_t *list,int id);
*/
extern
inline
int
flist_get_next_id
(
flist_t
*
list
,
int
id
);
#ifdef DIMAPI
/** \brief Searches for a mathcing node and returns it
Returns only the first matching node.
\param list a pointer to an existing list
\param comp function reference to be used for comparison of nodes
\param cdata 2nd argument to be passed to comparison function
\return Reference to the matching node's data, or NULL if no node
was matched
*/
extern
inline
void
*
flist_search
(
flist_t
*
,
int
(
*
compar
)(
void
*
,
void
*
),
void
*
);
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment