diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-10-16 21:39:13 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-10-16 21:39:13 +0000 |
commit | c67675b92cedd601de52a6f1999995bc23e07834 (patch) | |
tree | 6687cfef0271dde684837bfa12fd5bfbc7adedbe /URPM.xs | |
parent | 84c1076c198275d7e9364d02bfeb066932df6284 (diff) | |
download | perl-URPM-c67675b92cedd601de52a6f1999995bc23e07834.tar perl-URPM-c67675b92cedd601de52a6f1999995bc23e07834.tar.gz perl-URPM-c67675b92cedd601de52a6f1999995bc23e07834.tar.bz2 perl-URPM-c67675b92cedd601de52a6f1999995bc23e07834.tar.xz perl-URPM-c67675b92cedd601de52a6f1999995bc23e07834.zip |
reduce the scope of some variables (thanks cppcheck)
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 16 |
1 files changed, 7 insertions, 9 deletions
@@ -720,14 +720,14 @@ return_problems(rpmps ps, int translate_message, int raw_message) { static char * pack_list(const Header header, rpmTag tag_name, rpmTag tag_flags, rpmTag tag_version) { char buff[65536]; - rpmTag *flags = NULL; - char **list_evr = NULL; - unsigned int i; char *p = buff; struct rpmtd_s td; if (headerGet(header, tag_name, &td, HEADERGET_DEFAULT)) { char **list = td.data; + char **list_evr = NULL; + rpmTag *flags = NULL; + unsigned int i; struct rpmtd_s td_flags, td_list_evr; if (tag_flags && headerGet(header, tag_flags, &td_flags, HEADERGET_DEFAULT)) flags = td_flags.data; @@ -820,7 +820,6 @@ update_provides(const URPM__Package pkg, HV *provides) { if (pkg->h) { int len; struct rpmtd_s td, td_flags; - rpmsenseFlags *flags = NULL; unsigned int i; /* examine requires for files which need to be marked in provides */ @@ -835,6 +834,7 @@ update_provides(const URPM__Package pkg, HV *provides) { /* update all provides */ if (headerGet(pkg->h, RPMTAG_PROVIDENAME, &td, HEADERGET_DEFAULT)) { char **list = td.data; + rpmsenseFlags *flags = NULL; if (headerGet(pkg->h, RPMTAG_PROVIDEFLAGS, &td_flags, HEADERGET_DEFAULT)) flags = td_flags.data; for (i = 0; i < rpmtdCount(&td); ++i) { @@ -1022,21 +1022,19 @@ call_package_callback(SV *urpm, SV *sv_pkg, SV *callback) { static int parse_line(AV *depslist, HV *provides, HV *obsoletes, URPM__Package pkg, char *buff, SV *urpm, SV *callback) { - SV *sv_pkg; - URPM__Package _pkg; char *tag, *data; - int data_len; if (buff[0] == 0) return 1; else if ((tag = buff)[0] == '@' && (data = strchr(tag+1, '@')) != NULL) { *tag++ = *data++ = 0; - data_len = 1+strlen(data); + int data_len = 1+strlen(data); if (!strcmp(tag, "info")) { pkg->info = memcpy(malloc(data_len), data, data_len); pkg->flag &= ~FLAG_ID; pkg->flag |= 1 + av_len(depslist); - sv_pkg = sv_setref_pv(newSVpvs(""), "URPM::Package", + URPM__Package _pkg; + SV *sv_pkg = sv_setref_pv(newSVpvs(""), "URPM::Package", _pkg = memcpy(malloc(sizeof(struct s_Package)), pkg, sizeof(struct s_Package))); if (call_package_callback(urpm, sv_pkg, callback)) { if (provides) update_provides(_pkg, provides); |