From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 5/5] shared/queue: Make queue_find default do direct match for NULL callback
Date: Thu, 22 May 2014 13:34:03 +0300 [thread overview]
Message-ID: <1400754843-4759-5-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1400754843-4759-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
src/shared/queue.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/shared/queue.c b/src/shared/queue.c
index b589055..36da5fe 100644
--- a/src/shared/queue.c
+++ b/src/shared/queue.c
@@ -212,7 +212,7 @@ void queue_foreach(struct queue *queue, queue_foreach_func_t function,
function(tmp->data, user_data);
- if (!queue_find(queue, direct_match, entry))
+ if (!queue_find(queue, NULL, entry))
break;
}
queue_unref(queue);
@@ -226,6 +226,9 @@ void *queue_find(struct queue *queue, queue_match_func_t function,
if (!queue || !function)
return NULL;
+ if (!function)
+ function = direct_match;
+
for (entry = queue->head; entry; entry = entry->next)
if (function(entry->data, match_data))
return entry->data;
--
1.9.0
prev parent reply other threads:[~2014-05-22 10:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-22 10:33 [PATCH BlueZ 1/5] unit/test-queue: Add /queue/foreach_destroy test Luiz Augusto von Dentz
2014-05-22 10:34 ` [PATCH BlueZ 2/5] shared/queue: Fix queue_foreach not detecting queue has been destroyed Luiz Augusto von Dentz
2014-05-22 10:34 ` [PATCH BlueZ 3/5] unit/test-queue: Add /queue/foreach_remove_all test Luiz Augusto von Dentz
2014-06-27 8:53 ` Stefan Seyfried
2014-05-22 10:34 ` [PATCH BlueZ 4/5] shared/queue: Fix queue_foreach not detecting queue has changed Luiz Augusto von Dentz
2014-05-22 10:34 ` Luiz Augusto von Dentz [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400754843-4759-5-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).