added cppcheck
[ppastats.git] / src / lp.c
index 47d024e..67e6ed5 100644 (file)
--- a/src/lp.c
+++ b/src/lp.c
@@ -91,14 +91,18 @@ struct bpph *bpph_new(const char *binary_package_name,
 
 void bpph_list_free(struct bpph **list)
 {
-       struct bpph **l_cur = list;
+       struct bpph **cur;
 
-       while (*l_cur) {
-               bpph_free(*l_cur);
-               l_cur++;
-       }
+       if (list) {
+               cur = list;
 
-       free(list);
+               while (*cur) {
+                       bpph_free(*cur);
+                       cur++;
+               }
+
+               free(list);
+       }
 }
 
 char *get_archive_url(const char *owner, const char *ppa)
@@ -150,10 +154,13 @@ void distro_arch_series_free(struct distro_arch_series *d)
 
 void distro_arch_series_list_free(struct distro_arch_series **list)
 {
+       struct distro_arch_series **cur;
+
        if (list) {
-               while (*list) {
-                       distro_arch_series_free(*list);
-                       list++;
+               cur = list;
+               while (*cur) {
+                       distro_arch_series_free(*cur);
+                       cur++;
                }
                free(list);
        }
@@ -237,7 +244,7 @@ int ddts_length(struct daily_download_total **ddts)
        return n;
 }
 
-static struct daily_download_total *ddt_clone(struct daily_download_total *ddt)
+struct daily_download_total *ddt_clone(struct daily_download_total *ddt)
 {
        struct daily_download_total *new;
 
@@ -249,7 +256,7 @@ static struct daily_download_total *ddt_clone(struct daily_download_total *ddt)
        return new;
 }
 
-static struct daily_download_total **
+struct daily_download_total **
 ddts_clone(struct daily_download_total **ddts)
 {
        int n, i;