load bpph from cache and merge it the http request result
[ppastats.git] / src / lp.c
index 9ba2eec..bd9ba5d 100644 (file)
--- a/src/lp.c
+++ b/src/lp.c
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "list.h"
 #include "lp.h"
 
 struct distro_series *distro_series_new(const char *name,
@@ -169,3 +170,30 @@ void daily_download_total_list_free(struct daily_download_total **list)
        }
 }
 
+struct bpph **bpph_list_add(struct bpph **list, struct bpph *new)
+{
+       struct bpph **cur, *bpph;
+
+       if (list)
+               for (cur = list; *cur; cur++) {
+                       bpph = *cur;
+
+                       if (!strcmp(bpph->self_link, new->self_link))
+                               return list;
+               }
+
+       return (struct bpph **)list_add((void **)list, new);
+}
+
+struct bpph **bpph_list_append_list(struct bpph **list1, struct bpph **list2)
+{
+       struct bpph **cur;
+
+       if (!list2)
+               return list1;
+
+       for (cur = list2; *cur; cur++)
+               list1 = bpph_list_add(list1, *cur);
+
+       return list1;
+}