In some instance duplicate declarations were removed.
Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
---
This is a follow up for an earlier patch I sent back in December.
Apologies for not following up sooner. The feedback was to split the
patch up. This is the first patch from the split.
The API for alpm_checkdeps is slightly modified (a parameter is
renamed). I'm not sure whether this is a backwards incompatible change
or not.
Sorry for the size, I don't think it can be split up much further
without it turning into a dozen patches.
This patch was generated against the master branch.
if (errors) {
_alpm_log(PM_LOG_WARNING, _("failed to retrieve some files from %s
"),
- current->treename);
+ current_pkg->treename);
if(pm_errno == 0) {
pm_errno = PM_ERR_RETRIEVE;
}
@@ -785,7 +785,6 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
/* if we have deltas to work with */
if(handle->usedelta && deltas) {
- int ret = 0;
errors = 0;
/* Check integrity of deltas */
EVENT(trans, PM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL);
@@ -850,9 +849,9 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data)
pmdb_t *sdb = alpm_pkg_get_db(spkg);
/* Create a lock file */
-static int make_lock(pmhandle_t *handle)
+static int make_lock(pmhandle_t *local_handle)
{
int fd;
char *dir, *ptr;
/* create the dir of the lockfile first */
- dir = strdup(handle->lockfile);
+ dir = strdup(local_handle->lockfile);
ptr = strrchr(dir, '/');
if(ptr) {
*ptr = ' ';
@@ -71,27 +71,27 @@ static int make_lock(pmhandle_t *handle)
FREE(dir);
if USE_GIT_VERSION
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 08c1cf3..8e52eac 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -614,14 +614,14 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total)
/* if padwid is < 0, we need to trim the string so padwid = 0 */
if(padwid < 0) {
int i = filenamelen - 3;
- wchar_t *p = wcfname;
+ wchar_t *ptr = wcfname;
/* grab the max number of char columns we can fill */
- while(i > 0 && wcwidth(*p) < i) {
- i -= wcwidth(*p);
- p++;
+ while(i > 0 && wcwidth(*ptr) < i) {
+ i -= wcwidth(*ptr);
+ ptr++;
}
/* then add the ellipsis and fill out any extra padding */
- wcscpy(p, L"...");
+ wcscpy(ptr, L"...");
padwid = i;
}
diff --git a/src/pacman/query.c b/src/pacman/query.c
index d2bfe69..2bc3373 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -286,7 +286,6 @@ static int query_search(alpm_list_t *targets)
static int query_group(alpm_list_t *targets)
{
alpm_list_t *i, *j;
- char *grpname = NULL;
int ret = 0;
pmdb_t *db_local = alpm_option_get_localdb();
In some instance duplicate declarations were removed.
Signed-off-by: Sebastian Nowicki<sebnow@gmail.com>
---
This is a follow up for an earlier patch I sent back in December.
Apologies for not following up sooner. The feedback was to split the
patch up. This is the first patch from the split.
The API for alpm_checkdeps is slightly modified (a parameter is
renamed). I'm not sure whether this is a backwards incompatible change
or not.
Sorry for the size, I don't think it can be split up much further
without it turning into a dozen patches.
This patch was generated against the master branch.
I have not gone through all of these changes... I think adding extra
warnings etc should be done in configure.ac and only when --enable-debug
is specified (as is currently done with stack protector, -Werror etc).
But do we really want to add all these warnings in there? I use all of
these:
On Mon, Apr 4, 2011 at 7:26 AM, Allan McRae <allan@archlinux.org> wrote:
> On 03/04/11 20:49, Sebastian Nowicki wrote:
>
>> The following have been renamed to avoid shadowing:
>>
>> * conflict.c
>> - filestr -> pkgfilestr
>> - remove -> remove_pkgs
>> * deps.c
>> - index -> pkg_index
>> - remove -> remove_pkgs
>> - time -> epoch
>> * diskspace.c
>> - abort -> should_abort
>> * handle.c
>> - handle -> local_handle / new_handle
>> * package.c
>> - i -> deps
>> * sync.c (alpm)
>> - current -> current_pkg
>> - remove -> remove_pkgs
>> - ret -> gpg_ret
>> - sync -> syncpkg
>> * trans.c
>> - handle -> local_handle
>> * util.c (alpm)
>> - pipe -> pipefh
>> - prefix -> entry_prefix
>> * callback.c
>> - p -> ptr
>> * util.c (pacman)
>> - dup -> p
>>
>> In some instance duplicate declarations were removed.
>>
>> Signed-off-by: Sebastian Nowicki<sebnow@gmail.com>
>> ---
>> This is a follow up for an earlier patch I sent back in December.
>> Apologies for not following up sooner. The feedback was to split the
>> patch up. This is the first patch from the split.
>>
>> The API for alpm_checkdeps is slightly modified (a parameter is
>> renamed). I'm not sure whether this is a backwards incompatible change
>> or not.
>>
>> Sorry for the size, I don't think it can be split up much further
>> without it turning into a dozen patches.
>>
>> This patch was generated against the master branch.
>>
>> lib/libalpm/Makefile.am | 2 +-
>> lib/libalpm/alpm.h | 2 +-
>> lib/libalpm/conflict.c | 8 +++---
>> lib/libalpm/deps.c | 18 ++++++++--------
>> lib/libalpm/diskspace.c | 8 +++---
>> lib/libalpm/dload.c | 6 ++--
>> lib/libalpm/handle.c | 50
>> +++++++++++++++++++++++-----------------------
>> lib/libalpm/package.c | 6 ++--
>> lib/libalpm/sync.c | 37 ++++++++++++++++-----------------
>> lib/libalpm/trans.c | 18 ++++++++--------
>> lib/libalpm/util.c | 20 +++++++++---------
>> src/pacman/Makefile.am | 2 +-
>> src/pacman/callback.c | 10 ++++----
>> src/pacman/query.c | 2 +-
>> src/pacman/sync.c | 4 +--
>> src/pacman/upgrade.c | 1 -
>> src/pacman/util.c | 14 ++++++------
>> 17 files changed, 102 insertions(+), 106 deletions(-)
>>
>> diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
>> index fb224a5..21f7057 100644
>> --- a/lib/libalpm/Makefile.am
>> +++ b/lib/libalpm/Makefile.am
>> @@ -7,7 +7,7 @@ include_HEADERS = alpm_list.h alpm.h
>>
>> DEFS = -DLOCALEDIR="@localedir@" @DEFS@
>>
>> -AM_CFLAGS = -pedantic -D_GNU_SOURCE
>> +AM_CFLAGS = -pedantic -Wshadow -D_GNU_SOURCE
>>
>
> I have not gone through all of these changes... I think adding extra
> warnings etc should be done in configure.ac and only when --enable-debug
> is specified (as is currently done with stack protector, -Werror etc).
>
> But do we really want to add all these warnings in there? I use all of
> these:
>
> -Wclobbered -Wempty-body -Wfloat-equal -Wignored-qualifiers
> -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes
> -Wold-style-declaration -Woverride-init -Wsign-compare -Wstrict-prototypes
> -Wtype-limits -Wuninitialized
>
> I'm not sure anybody wants that...
>
> Allan
>
>
I wasn't going to add it initially, but thought this would prevent shadowing
sneaking back in again. I don't really mind either way though.
04-04-2011, 09:04 AM
Xavier
Fix -Wshadow warnings
Allan McRae wrote:
>
> But do we really want to add all these warnings in there? I use
> all of these:
>
> -Wclobbered -Wempty-body -Wfloat-equal -Wignored-qualifiers
> -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes
> -Wold-style-declaration -Woverride-init -Wsign-compare
> -Wstrict-prototypes -Wtype-limits -Wuninitialized
>
> I'm not sure anybody wants that...
>
If they pass (or close to), why not ? Developers should follow the same rules to
not break something that was respected before and to keep a consistent codebase.
04-05-2011, 05:37 AM
Dan McGee
Fix -Wshadow warnings
On Sun, Apr 3, 2011 at 6:26 PM, Allan McRae <allan@archlinux.org> wrote:
> On 03/04/11 20:49, Sebastian Nowicki wrote:
>>
>> The following have been renamed to avoid shadowing:
>>
>> * * * ** conflict.c
>> * * * * * * * *- filestr -> *pkgfilestr
>> * * * * * * * *- remove -> *remove_pkgs
>> * * * ** deps.c
>> * * * * * * * *- index -> *pkg_index
>> * * * * * * * *- remove -> *remove_pkgs
>> * * * * * * * *- time -> *epoch
>> * * * ** diskspace.c
>> * * * * * * * *- abort -> *should_abort
>> * * * ** handle.c
>> * * * * * * * *- handle -> *local_handle / new_handle
>> * * * ** package.c
>> * * * * * *- i -> *deps
>> * * * ** sync.c (alpm)
>> * * * * * * * *- current -> *current_pkg
>> * * * * * * * *- remove -> *remove_pkgs
>> * * * * * * * *- ret -> *gpg_ret
>> * * * * * * * *- sync -> *syncpkg
>> * * * ** trans.c
>> * * * * * * * *- handle -> *local_handle
>> * * * ** util.c (alpm)
>> * * * * * * * *- pipe -> *pipefh
>> * * * * * * * *- prefix -> *entry_prefix
>> * * * ** callback.c
>> * * * * * *- p -> *ptr
>> * * * ** util.c (pacman)
>> * * * * * * * *- dup -> *p
>>
>> In some instance duplicate declarations were removed.
>>
>> Signed-off-by: Sebastian Nowicki<sebnow@gmail.com>
>> ---
>>
>> diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
>> index fb224a5..21f7057 100644
>> --- a/lib/libalpm/Makefile.am
>> +++ b/lib/libalpm/Makefile.am
>> @@ -7,7 +7,7 @@ include_HEADERS = alpm_list.h alpm.h
>>
>> *DEFS = -DLOCALEDIR="@localedir@" @DEFS@
>>
>> -AM_CFLAGS = -pedantic -D_GNU_SOURCE
>> +AM_CFLAGS = -pedantic -Wshadow -D_GNU_SOURCE
>
> I have not gone through all of these changes... * I think adding extra
> warnings etc should be done in configure.ac and only when --enable-debug is
> specified *(as is currently done with stack protector, -Werror etc).
Yes, this is the only place they belong, definitely not in the
Makefile (and only in the libalpm Makefile, why?).
> But do we really want to add all these warnings in there? * I use all of
> these:
>
> -Wclobbered -Wempty-body -Wfloat-equal -Wignored-qualifiers
> -Wmissing-declarations -Wmissing-parameter-type -Wmissing-prototypes
> -Wold-style-declaration -Woverride-init -Wsign-compare -Wstrict-prototypes
> -Wtype-limits -Wuninitialized
>
> I'm not sure anybody wants that...
I'm not against it, provided:
1. When it is checked in, the compile doesn't break.
2. When someone uses "exotic" compiliers such as icc, gcc 3.x,
whatever Cygwin has, and clang, we don't blow up or make the output
that much worse for them.
-Dan
04-05-2011, 11:16 AM
Sebastian Nowicki
Fix -Wshadow warnings
On Tue, Apr 5, 2011 at 1:37 PM, Dan McGee <dpmcgee@gmail.com> wrote:
> On Sun, Apr 3, 2011 at 6:26 PM, Allan McRae <allan@archlinux.org> wrote:
> > On 03/04/11 20:49, Sebastian Nowicki wrote:
> >> diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
> >> index fb224a5..21f7057 100644
> >> --- a/lib/libalpm/Makefile.am
> >> +++ b/lib/libalpm/Makefile.am
> >> @@ -7,7 +7,7 @@ include_HEADERS = alpm_list.h alpm.h
> >>
> >> DEFS = -DLOCALEDIR="@localedir@" @DEFS@
> >>
> >> -AM_CFLAGS = -pedantic -D_GNU_SOURCE
> >> +AM_CFLAGS = -pedantic -Wshadow -D_GNU_SOURCE
> >
> > I have not gone through all of these changes... I think adding extra
> > warnings etc should be done in configure.ac and only when --enable-debug
> is
> > specified (as is currently done with stack protector, -Werror etc).
> Yes, this is the only place they belong, definitely not in the
> Makefile (and only in the libalpm Makefile, why?).
It was added to the pacman Makefile as well (later down in the patch),
wasn't really sure where to put it since I couldn't find other warning flags
(aside from -Wall).
I guess I'll just put it in the configure.ac script for now. It can always
be removed later if it causes issues. Might even check if icc produces
different results.