[pacman-dev] [PATCH] Removed multiple definitions of pkgfrom_t

Dan McGee dpmcgee at gmail.com
Sun Aug 28 21:02:39 EDT 2011


On Sat, Aug 27, 2011 at 12:25 AM, Diogo Sousa <diogogsousa at gmail.com> wrote:
> libalpm now exports type alpm_pkgfrom_t in alpm.h, which may be
> used by frontends.
> Pacman now uses alpm_pkgfrom_t instead
> of replicating that type (pkg_from as was in
> src/pacman/package.h)
This is a bit nitpicky, but what's up with your line wrapping here?
Either make this all one paragraph, or put a blank line between them
and wrap around 76 characters consistently, please.

> Signed-off-by: Diogo Sousa <diogogsousa at gmail.com>
> ---
>  lib/libalpm/alpm.h    |    6 ++++++
>  lib/libalpm/package.h |    6 ------
>  src/pacman/package.c  |    2 +-
>  src/pacman/package.h  |    9 +--------
>  4 files changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
> index fc8f0bc..b1e9a88 100644
> --- a/lib/libalpm/alpm.h
> +++ b/lib/libalpm/alpm.h
> @@ -197,6 +197,12 @@ typedef struct _alpm_file_t {
>        mode_t mode;
>  } alpm_file_t;
>
> +typedef enum _alpm_pkgfrom_t {
> +       PKG_FROM_FILE = 1,
> +       PKG_FROM_LOCALDB,
> +       PKG_FROM_SYNCDB
> +} alpm_pkgfrom_t;
> +
Good to move this. However, I have no idea whatsoever provoked you to
put it in the middle of a bunch of structs, not to mention two structs
that don't even use the enum! This should probably go right underneath
the pkgreason enum definition.

>  /** Package filelist container */
>  typedef struct _alpm_filelist_t {
>        size_t count;
> diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
> index 25d1b1a..a75f6ae 100644
> --- a/lib/libalpm/package.h
> +++ b/lib/libalpm/package.h
> @@ -34,12 +34,6 @@
>  #include "db.h"
>  #include "signing.h"
>
> -typedef enum _alpm_pkgfrom_t {
> -       PKG_FROM_FILE = 1,
> -       PKG_FROM_LOCALDB,
> -       PKG_FROM_SYNCDB
> -} alpm_pkgfrom_t;
> -
>  /** Package operations struct. This struct contains function pointers to
>  * all methods used to access data in a package to allow for things such
>  * as lazy package intialization (such as used by the file backend). Each
> diff --git a/src/pacman/package.c b/src/pacman/package.c
> index 80c6bf2..ef483ef 100644
> --- a/src/pacman/package.c
> +++ b/src/pacman/package.c
> @@ -61,7 +61,7 @@ static void deplist_display(const char *title,
>  * @param from the type of package we are dealing with
>  * @param extra should we show extra information
>  */
> -void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra)
> +void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra)
>  {
>        const char *reason;
>        time_t bdate, idate;
> diff --git a/src/pacman/package.h b/src/pacman/package.h
> index 6f71d20..4bbc2ba 100644
> --- a/src/pacman/package.h
> +++ b/src/pacman/package.h
> @@ -22,14 +22,7 @@
>
>  #include <alpm.h>
>
> -/* TODO it would be nice if we didn't duplicate a backend type */
> -enum pkg_from {
> -       PKG_FROM_FILE = 1,
> -       PKG_FROM_LOCALDB,
> -       PKG_FROM_SYNCDB
> -};
> -
> -void dump_pkg_full(alpm_pkg_t *pkg, enum pkg_from from, int extra);
> +void dump_pkg_full(alpm_pkg_t *pkg, alpm_pkgfrom_t from, int extra);
>
>  void dump_pkg_backups(alpm_pkg_t *pkg);
>  void dump_pkg_files(alpm_pkg_t *pkg, int quiet);
> --
> 1.7.6.1

Otherwise looks good- resubmit with these changes and I'll commit it.

-Dan


More information about the pacman-dev mailing list