Imported Upstream version 1.3.2 upstream/1.3.2
authorJean-Philippe Orsini <jeanfi@gmail.com>
Sun, 2 Nov 2014 09:33:24 +0000 (10:33 +0100)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Sun, 2 Nov 2014 09:33:24 +0000 (10:33 +0100)
14 files changed:
NEWS
aclocal.m4
configure
configure.ac
po/fr.gmo
po/fr.po
po/ppastats.pot
src/lp_json.c
src/lp_ws.c
src/pio.c
src/pio.h
src/ppastats.1
themes/default/css/wpitchoune.css
themes/default/templates/footer.tpl

diff --git a/NEWS b/NEWS
index 1b09d49..6bc4688 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+v1.3.2
+------
+
+* fixed compilation against newer version of json-c (deprecation
+  of the function json_object_object_get).
+* fixed layout issues due to missing box-sizing properties.
+* fixed file description leaks.
+
 v1.3.1
 ------
 
index df754fc..d56243f 100644 (file)
@@ -180,6 +180,61 @@ else
 fi[]dnl
 ])# PKG_CHECK_MODULES
 
+
+# PKG_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable pkgconfigdir as the location where a module
+# should install pkg-config .pc files. By default the directory is
+# $libdir/pkgconfig, but the default can be changed by passing
+# DIRECTORY. The user can override through the --with-pkgconfigdir
+# parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_INSTALLDIR
+
+
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable noarch_pkgconfigdir as the location where a
+# module should install arch-independent pkg-config .pc files. By
+# default the directory is $datadir/pkgconfig, but the default can be
+# changed by passing DIRECTORY. The user can override through the
+# --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_NOARCH_INSTALLDIR
+
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
+
 # Copyright (C) 2002-2013 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
@@ -733,7 +788,8 @@ to "yes", and re-run configure.
 END
     AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
   fi
-fi])
+fi
+])
 
 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
index 160f305..9a69925 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ppastats 1.3.1.
+# Generated by GNU Autoconf 2.69 for ppastats 1.3.2.
 #
 # Report bugs to <jeanfi@gmail.com>.
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='ppastats'
 PACKAGE_TARNAME='ppastats'
-PACKAGE_VERSION='1.3.1'
-PACKAGE_STRING='ppastats 1.3.1'
+PACKAGE_VERSION='1.3.2'
+PACKAGE_STRING='ppastats 1.3.2'
 PACKAGE_BUGREPORT='jeanfi@gmail.com'
 PACKAGE_URL='http://wpitchoune.net/ppastats'
 
@@ -1321,7 +1321,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures ppastats 1.3.1 to adapt to many kinds of systems.
+\`configure' configures ppastats 1.3.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1395,7 +1395,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of ppastats 1.3.1:";;
+     short | recursive ) echo "Configuration of ppastats 1.3.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1509,7 +1509,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-ppastats configure 1.3.1
+ppastats configure 1.3.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1865,7 +1865,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by ppastats $as_me 1.3.1, which was
+It was created by ppastats $as_me 1.3.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2730,7 +2730,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='ppastats'
- VERSION='1.3.1'
+ VERSION='1.3.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2824,6 +2824,7 @@ END
 fi
 
 
+
 ac_config_headers="$ac_config_headers config.h"
 
 
@@ -6895,12 +6896,12 @@ if test -n "$JSON_CFLAGS"; then
     pkg_cv_JSON_CFLAGS="$JSON_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c >= 0.11.99\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c >= 0.11.99") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json-c" 2>/dev/null`
+  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json-c >= 0.11.99" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -6912,12 +6913,12 @@ if test -n "$JSON_LIBS"; then
     pkg_cv_JSON_LIBS="$JSON_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c >= 0.11.99\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c >= 0.11.99") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json-c" 2>/dev/null`
+  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json-c >= 0.11.99" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -6938,9 +6939,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c" 2>&1`
+               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c >= 0.11.99" 2>&1`
         else
-               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c" 2>&1`
+               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c >= 0.11.99" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$JSON_PKG_ERRORS" >&5
@@ -6972,12 +6973,12 @@ if test -n "$JSON_CFLAGS"; then
     pkg_cv_JSON_CFLAGS="$JSON_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json >= 0.11.99\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json >= 0.11.99") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json" 2>/dev/null`
+  pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json >= 0.11.99" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -6989,12 +6990,12 @@ if test -n "$JSON_LIBS"; then
     pkg_cv_JSON_LIBS="$JSON_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json") 2>&5
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json >= 0.11.99\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json >= 0.11.99") 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json" 2>/dev/null`
+  pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json >= 0.11.99" 2>/dev/null`
                      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -7015,9 +7016,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json" 2>&1`
+               JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json >= 0.11.99" 2>&1`
         else
-               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json" 2>&1`
+               JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json >= 0.11.99" 2>&1`
         fi
        # Put the nasty error message in config.log where it belongs
        echo "$JSON_PKG_ERRORS" >&5
@@ -7693,7 +7694,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by ppastats $as_me 1.3.1, which was
+This file was extended by ppastats $as_me 1.3.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -7760,7 +7761,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-ppastats config.status 1.3.1
+ppastats config.status 1.3.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index ac991b4..0a898e9 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.64])
-AC_INIT([ppastats], [1.3.1],[jeanfi@gmail.com],[ppastats],[http://wpitchoune.net/ppastats])
+AC_INIT([ppastats], [1.3.2],[jeanfi@gmail.com],[ppastats],[http://wpitchoune.net/ppastats])
 
 AM_INIT_AUTOMAKE([-Wall gnu])
 
@@ -32,13 +32,13 @@ AC_SUBST(CURL_LIBS)
 # Checks JSON
 JSON_LIBS=
 PKG_CHECK_MODULES(JSON, 
-                 json-c
+                 json-c >= 0.11.99,
                  [AC_DEFINE([HAVE_JSON],[1],[Use JSON])], 
                  [AC_MSG_WARN("json-c missing")])
 
 if test "$JSON_LIBS" == ""; then
 PKG_CHECK_MODULES(JSON, 
-                 json, 
+                 json >= 0.11.99
                  [AC_DEFINE([HAVE_JSON],[1],[Use JSON])
                   AC_DEFINE([HAVE_JSON_0],[1],[Use JSON0])], 
                  [AC_MSG_WARN("json0 missing")])
index 8f4629d..fcf9830 100644 (file)
Binary files a/po/fr.gmo and b/po/fr.gmo differ
index 03743ff..2066abc 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ppastats 0.0.x\n"
 "Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2014-04-22 10:58+0200\n"
+"POT-Creation-Date: 2014-11-02 10:22+0100\n"
 "PO-Revision-Date: 2012-05-05 23:45+0200\n"
 "Last-Translator:  <jeanfi@gmail.com>\n"
 "Language-Team: French\n"
index 6bc7dff..95ef14a 100644 (file)
@@ -6,9 +6,9 @@
 #, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: ppastats 1.3.1\n"
+"Project-Id-Version: ppastats 1.3.2\n"
 "Report-Msgid-Bugs-To: jeanfi@gmail.com\n"
-"POT-Creation-Date: 2014-04-22 10:58+0200\n"
+"POT-Creation-Date: 2014-11-02 10:22+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
index f050307..af8e8cd 100644 (file)
@@ -37,7 +37,6 @@ static time_t json_to_time(json_object *json)
        if (!str)
                return -1;
 
-
        memset(&tm, 0, sizeof(struct tm));
        tm.tm_isdst = -1;
        ret = strptime(str, "%FT%T", &tm);
@@ -74,25 +73,28 @@ static struct bpph *json_to_bpph(json_object *o)
        struct bpph *bpph;
        const char *status;
        time_t date_created;
+       json_object *j;
 
-       binary_package_name = json_object_get_string
-               (json_object_object_get(o, "binary_package_name"));
+       json_object_object_get_ex(o, "binary_package_name", &j);
+       binary_package_name = json_object_get_string(j);
 
-       binary_package_version = json_object_get_string
-               (json_object_object_get(o, "binary_package_version"));
+       json_object_object_get_ex(o, "binary_package_version", &j);
+       binary_package_version = json_object_get_string(j);
 
-       distro_arch_series_link = json_object_get_string
-               (json_object_object_get(o, "distro_arch_series_link"));
+       json_object_object_get_ex(o, "distro_arch_series_link", &j);
+       distro_arch_series_link = json_object_get_string(j);
 
-       self_link = json_object_get_string
-               (json_object_object_get(o, "self_link"));
+       json_object_object_get_ex(o, "self_link", &j);
+       self_link = json_object_get_string(j);
 
-       arch_specific = json_object_get_boolean
-               (json_object_object_get(o, "architecture_specific"));
+       json_object_object_get_ex(o, "architecture_specific", &j);
+       arch_specific = json_object_get_boolean(j);
 
-       date_created = json_to_time(json_object_object_get(o, "date_created"));
+       json_object_object_get_ex(o, "date_created", &j);
+       date_created = json_to_time(j);
 
-       status = json_object_get_string(json_object_object_get(o, "status"));
+       json_object_object_get_ex(o, "status", &j);
+       status = json_object_get_string(j);
 
        bpph =  bpph_new(binary_package_name,
                         binary_package_version,
@@ -151,21 +153,23 @@ struct distro_arch_series *json_object_to_distro_arch_series(json_object *o)
        const char *architecture_tag;
        json_bool is_nominated_arch_indep;
        const char *distroseries_link;
+       json_object *j;
 
-       display_name = json_object_get_string
-               (json_object_object_get(o, "display_name"));
+       json_object_object_get_ex(o, "display_name", &j);
+       display_name = json_object_get_string(j);
 
-       title = json_object_get_string
-               (json_object_object_get(o, "title"));
+       json_object_object_get_ex(o, "title", &j);
+       title = json_object_get_string(j);
 
-       architecture_tag = json_object_get_string
-               (json_object_object_get(o, "architecture_tag"));
+       json_object_object_get_ex(o, "architecture_tag", &j);
+       architecture_tag = json_object_get_string(j);
 
-       distroseries_link = json_object_get_string
-               (json_object_object_get(o, "distroseries_link"));
+       json_object_object_get_ex(o, "distroseries_link", &j);
+       distroseries_link = json_object_get_string(j);
 
+       json_object_object_get_ex(o, "is_nominated_arch_indep", &j);
        is_nominated_arch_indep = json_object_get_boolean
-               (json_object_object_get(o, "is_nominated_arch_indep"));
+               (j);
 
        return distro_arch_series_new(display_name,
                                      title,
@@ -180,15 +184,19 @@ struct distro_series *json_object_to_distro_series(json_object *o)
        const char *title;
        const char *name;
        const char *version;
+       json_object *j;
 
-       displayname = json_object_get_string
-               (json_object_object_get(o, "displayname"));
+       json_object_object_get_ex(o, "displayname", &j);
+       displayname = json_object_get_string(j);
 
-       title = json_object_get_string(json_object_object_get(o, "title"));
+       json_object_object_get_ex(o, "title", &j);
+       title = json_object_get_string(j);
 
-       version = json_object_get_string(json_object_object_get(o, "version"));
+       json_object_object_get_ex(o, "version", &j);
+       version = json_object_get_string(j);
 
-       name = json_object_get_string(json_object_object_get(o, "name"));
+       json_object_object_get_ex(o, "name", &j);
+       name = json_object_get_string(j);
 
        return distro_series_new(name,
                                 version,
@@ -203,7 +211,7 @@ struct bpph **json_object_to_bpph_list(json_object *o)
        struct bpph **entries, *h;
        const struct distro_arch_series *distro;
 
-       o_entries = json_object_object_get(o, "entries");
+       json_object_object_get_ex(o, "entries", &o_entries);
 
        if (!o_entries)
                return NULL;
index f04f169..fe93e39 100644 (file)
@@ -205,7 +205,7 @@ struct bpph **get_bpph_list(const char *archive_url,
                result = bpph_list_append_list(result,
                                               json_object_to_bpph_list(o));
 
-               o_next = json_object_object_get(o, "next_collection_link");
+               json_object_object_get_ex(o, "next_collection_link", &o_next);
 
                if (o_next)
                        url = strdup(json_object_get_string(o_next));
index 701823d..2f806b8 100644 (file)
--- a/src/pio.c
+++ b/src/pio.c
@@ -1,21 +1,23 @@
 /*
-    Copyright (C) 2010-2014 wpitchoune@gmail.com
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-    02110-1301 USA
-*/
+ * Copyright (C) 2010-2014 jeanfi@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#define _LARGEFILE_SOURCE 1
+#include "config.h"
 
 #include <dirent.h>
 #include <fts.h>
@@ -80,11 +82,24 @@ char *dir_normalize(const char *dpath)
        return npath;
 }
 
-char **dir_list(const char *dpath, int (*filter) (const char *path))
+static char **paths_add(char **paths, int n, char *path)
+{
+       char **result;
+
+       result = malloc((n+1) * sizeof(void *));
+
+       memcpy(result + 1, paths, n * sizeof(void *));
+
+       *result = path;
+
+       return result;
+}
+
+char **dir_list(const char *dpath, int (*filter) (const char *))
 {
        struct dirent *ent;
        DIR *dir;
-       char **paths;
+       char **paths, *path, *name, **tmp;
        int n;
 
        dir = opendir(dpath);
@@ -97,30 +112,21 @@ char **dir_list(const char *dpath, int (*filter) (const char *path))
        *paths = NULL;
 
        while ((ent = readdir(dir)) != NULL) {
-               char *fpath;
-               char *name = ent->d_name;
+               name = ent->d_name;
 
                if (!strcmp(name, ".") || !strcmp(name, ".."))
                        continue;
 
-               fpath = malloc(strlen(dpath) + 1 + strlen(name) + 1);
+               path = path_append(dpath, name);
 
-               strcpy(fpath, dpath);
-               strcat(fpath, "/");
-               strcat(fpath, name);
-
-               if (!filter || filter(fpath)) {
-                       char **npaths;
-
-                       n++;
-                       npaths = malloc(n * sizeof(void *));
-                       memcpy(npaths + 1, paths, (n - 1) * sizeof(void *));
+               if (!filter || filter(path)) {
+                       tmp = paths_add(paths, n, path);
                        free(paths);
-                       paths = npaths;
-                       *npaths = fpath;
+                       paths = tmp;
 
+                       n++;
                } else {
-                       free(fpath);
+                       free(path);
                }
        }
 
@@ -163,11 +169,11 @@ char *file_get_content(const char *fpath)
                        page = malloc(size + 1);
                        if (!page || size != fread(page, 1, size, fp)) {
                                free(page);
-                               return NULL;
+                               page = NULL;
+                       } else {
+                               *(page + size) = '\0';
                        }
 
-                       *(page + size) = '\0';
-
                        fclose(fp);
                } else {
                        page = NULL;
@@ -180,25 +186,24 @@ char *file_get_content(const char *fpath)
 long file_get_size(const char *path)
 {
        FILE *fp;
+       long size;
 
        if (!is_file(path))
                return -1;
 
        fp = fopen(path, "rb");
        if (fp) {
-               long size;
-
                if (fseek(fp, 0, SEEK_END) == -1)
-                       return -1;
-
-               size = ftell(fp);
+                       size = -1;
+               else
+                       size = ftell(fp);
 
                fclose(fp);
-
-               return size;
+       } else {
+               size = -1;
        }
 
-       return -1;
+       return size;
 }
 
 #define FCOPY_BUF_SZ 4096
index 7b38a41..385ad33 100644 (file)
--- a/src/pio.h
+++ b/src/pio.h
@@ -20,7 +20,7 @@
 #ifndef _P_IO_H
 #define _P_IO_H
 
-#define P_IO_VER 2
+#define P_IO_VER 4
 
 /* Returns '1' if a given 'path' denotates a directory else returns
    0 */
index 4b17424..782ec64 100644 (file)
@@ -1,10 +1,10 @@
-.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.44.1.
-.TH PPASTATS "1" "April 2014" "ppastats 1.3.1" "User Commands"
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.46.2.
+.TH PPASTATS "1" "November 2014" "ppastats 1.3.2" "User Commands"
 .SH NAME
 ppastats \- PPA Statistics command line tool
 .SH SYNOPSIS
 .B ppastats
-[\fIOPTION\fR]... \fIPPA_OWNER PPA_NAME\fR
+[\fI\,OPTION\/\fR]... \fI\,PPA_OWNER PPA_NAME\/\fR
 .SH DESCRIPTION
 ppastats is a command application for generating PPA statistics.
 .PP
@@ -18,13 +18,13 @@ display this help and exit
 \fB\-v\fR, \fB\-\-version\fR
 display version information and exit
 .TP
-\fB\-o\fR, \fB\-\-output\-dir\fR=\fI[PATH]\fR
+\fB\-o\fR, \fB\-\-output\-dir\fR=\fI\,[PATH]\/\fR
 generates HTML pages into 'PATH'
 .TP
-\fB\-t\fR, \fB\-\-theme\-dir\fR=\fI[PATH]\fR
+\fB\-t\fR, \fB\-\-theme\-dir\fR=\fI\,[PATH]\/\fR
 set theme dir to 'PATH'
 .TP
-\fB\-s\fR, \fB\-\-status\fR=\fI[STATUS]\fR
+\fB\-s\fR, \fB\-\-status\fR=\fI\,[STATUS]\/\fR
 retrieves only package of the given status
 (possible values are: Pending, Published,
 Superseded, Deleted or Obsolete)
@@ -32,7 +32,7 @@ Superseded, Deleted or Obsolete)
 \fB\-S\fR, \fB\-\-skip\-js\-css\fR
 skip installation of js and css files
 .TP
-\fB\-\-get\-bpph\-size\fR=\fI[s]\fR
+\fB\-\-get\-bpph\-size\fR=\fI\,[s]\/\fR
 size of the replies of webservice requests to get
 the list of binary packages. Between 1 and 300.
 .SH "REPORTING BUGS"
index 32cb5d0..cedf0c1 100644 (file)
@@ -116,8 +116,9 @@ table {
 
 #main, #menu {
     background: #ffffff;
-
-   -moz-box-sizing: border-box;
+    
+    -moz-box-sizing: border-box;
+    box-sizing: border-box;
 
     padding: 1em 1em 1em 1em;
 
@@ -151,7 +152,8 @@ table {
     margin: 0em 0em 2em 0em;
     
     background: #ffffff;
-   -moz-box-sizing: border-box;
+    -moz-box-sizing: border-box;
+    box-sizing: border-box;
     padding: 2em 2em 2em 2em;
 
     -moz-border-radius: 4px;
index 7041fab..ea91747 100644 (file)
@@ -1,5 +1,5 @@
     <div id="footer">
-      Generated by <a href='http://wpitchoune.net/ppastats'>ppastats</a> v1.3.1
+      Generated by <a href='http://wpitchoune.net/ppastats'>ppastats</a> v1.3.2
     </div>
     </div>
   </body>