summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eb18372)
raw | patch | inline | side by side (parent: eb18372)
author | Hamish Coleman <hamish@zot.org> | |
Fri, 17 Feb 2017 07:51:35 +0000 (15:51 +0800) | ||
committer | Hamish Coleman <hamish@zot.org> | |
Tue, 9 May 2017 01:10:18 +0000 (09:10 +0800) |
src/liboping.c | patch | blob | history | |
src/oping.h | patch | blob | history |
diff --git a/src/liboping.c b/src/liboping.c
index fc9ed65c63198f081a9e5ecb2b7dc2ab474177a9..7af4e4a239ee17bf28828f2124bd52afc6a8772d 100644 (file)
--- a/src/liboping.c
+++ b/src/liboping.c
return ((pingobj_iter_t *) iter->next);
}
+int ping_iterator_count (pingobj_t *obj)
+{
+ if (obj == NULL)
+ return 0;
+
+ int count = 0;
+ pingobj_iter_t *iter = obj->head;
+ while(iter) {
+ count++;
+ iter = iter->next;
+ }
+ return count;
+}
+
int ping_iterator_get_info (pingobj_iter_t *iter, int info,
void *buffer, size_t *buffer_len)
{
diff --git a/src/oping.h b/src/oping.h
index 1970ef273f40e634c689cf8cfacf7b654c31d55c..50d11fbb08870077d0ee21004480af6aa2a55809 100644 (file)
--- a/src/oping.h
+++ b/src/oping.h
pingobj_iter_t *ping_iterator_get (pingobj_t *obj);
pingobj_iter_t *ping_iterator_next (pingobj_iter_t *iter);
+int ping_iterator_count (pingobj_t *obj);
#define PING_INFO_HOSTNAME 1
#define PING_INFO_ADDRESS 2