From f97d7425a82051ba49bc701ee4342cd935ed4faa Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 29 Sep 2011 15:32:39 +0000 Subject: lwc version of ring function. svn path=/trunk/netsurf/; revision=12911 --- utils/ring.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'utils') diff --git a/utils/ring.h b/utils/ring.h index a40f882a2..42fd676eb 100644 --- a/utils/ring.h +++ b/utils/ring.h @@ -81,6 +81,25 @@ if (!found) element = 0; \ } else element = 0 +/** Find the element (by hostname) in the given ring, leave it in the + * provided element variable + */ +#define RING_FINDBYLWCHOST(ring, element, lwc_hostname) \ + /*LOG(("RING_FINDBYHOST(%s, %s)", #ring, hostname));*/ \ + if (ring) { \ + bool found = false; \ + element = ring; \ + do { \ + if (lwc_string_isequal(element->host, lwc_hostname, \ + &found) == lwc_error_ok && \ + found == true) { \ + break; \ + } \ + element = element->r_next; \ + } while (element != ring); \ + if (!found) element = 0; \ + } else element = 0 + /** Measure the size of a ring and put it in the supplied variable */ #define RING_GETSIZE(ringtype, ring, sizevar) \ /*LOG(("RING_GETSIZE(%s)", #ring));*/ \ -- cgit v1.2.3