2 * Copyright (C) 2011-2012 jeanfi@gmail.com
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 struct distro_series *distro_series_new(const char *name,
29 const char *displayname)
31 struct distro_series *d;
33 d = malloc(sizeof(struct distro_series));
35 d->name = strdup(name);
36 d->version = strdup(version);
37 d->title = strdup(title);
38 d->displayname = strdup(displayname);
43 void distro_series_free(struct distro_series *d)
55 void bpph_free(struct bpph *b)
58 free(b->binary_package_name);
59 free(b->binary_package_version);
60 free(b->distro_arch_series_link);
66 struct bpph *bpph_new(const char *binary_package_name,
67 const char *binary_package_version,
68 const char *distro_arch_series_link,
69 const char *self_link,
70 int architecture_specific)
74 h = malloc(sizeof(struct bpph));
76 h->binary_package_name = strdup(binary_package_name);
77 h->binary_package_version = strdup(binary_package_version);
78 h->distro_arch_series_link = strdup(distro_arch_series_link);
79 h->self_link = strdup(self_link);
80 h->architecture_specific = architecture_specific;
85 void bpph_list_free(struct bpph **list)
87 struct bpph **l_cur = list;
97 char *get_archive_url(const char *owner, const char *ppa)
99 char *url = malloc(strlen(URL_BASE_LP)
102 +strlen("/+archive/")
106 strcpy(url, URL_BASE_LP);
109 strcat(url, "/+archive/");
115 struct distro_arch_series *distro_arch_series_new(const char *display_name,
117 const char *architecture_tag,
118 int is_nominated_arch_indep,
119 const char *distroseries_link)
121 struct distro_arch_series *d;
123 d = malloc(sizeof(struct distro_arch_series));
125 d->display_name = strdup(display_name);
126 d->title = strdup(title);
127 d->architecture_tag = strdup(architecture_tag);
128 d->is_nominated_arch_indep = is_nominated_arch_indep;
129 d->distroseries_link = strdup(distroseries_link);
134 void distro_arch_series_free(struct distro_arch_series *d)
136 free(d->display_name);
138 free(d->architecture_tag);
139 free(d->distroseries_link);
144 void distro_arch_series_list_free(struct distro_arch_series **list)
148 distro_arch_series_free(*list);
155 void daily_download_total_list_free(struct daily_download_total **list)
158 struct daily_download_total **cur = list;