summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-09-29 15:32:39 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-09-29 15:32:39 +0000
commitf97d7425a82051ba49bc701ee4342cd935ed4faa (patch)
treef7c2ad607e41fde77a5d1eeb16e8d0bd194c98b1
parent6cfd37e60f0181916906de67c9f86cf54ab565c2 (diff)
downloadnetsurf-f97d7425a82051ba49bc701ee4342cd935ed4faa.tar.gz
netsurf-f97d7425a82051ba49bc701ee4342cd935ed4faa.tar.bz2
lwc version of ring function.
svn path=/trunk/netsurf/; revision=12911
-rw-r--r--utils/ring.h19
1 files changed, 19 insertions, 0 deletions
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));*/ \