+static struct daily_download_total **add_total
+(struct daily_download_total **totals, struct daily_download_total *total)
+{
+ struct daily_download_total **cur;
+ struct daily_download_total *item;
+
+ if (totals) {
+ cur = totals;
+ while (*cur) {
+ item = *cur;
+
+ if (item->date.tm_year == total->date.tm_year &&
+ item->date.tm_mon == total->date.tm_mon &&
+ item->date.tm_mday == total->date.tm_mday) {
+ item->count += total->count;
+ return totals;
+ }
+
+ cur++;
+ }
+ }
+
+ item = malloc(sizeof(struct daily_download_total));
+ memcpy(item, total, sizeof(struct daily_download_total));
+
+ return (struct daily_download_total **)
+ list_add((void **)totals, (void *)item);
+}
+
+struct daily_download_total **add_totals
+(struct daily_download_total **total1, struct daily_download_total **total2)
+{
+ struct daily_download_total **cur;
+ struct daily_download_total **result;
+
+ result = total1;
+ cur = total2;
+ while (*cur) {
+ result = add_total(result, *cur);
+
+ cur++;
+ }
+
+ return result;
+}
+
+static void
+pkg_add_distro(struct package_stats *pkg,
+ const char *distro_name,
+ int distro_count,
+ struct daily_download_total **ddts)