diff options
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -3047,14 +3047,13 @@ Urpm_parse_hdlist__XS(urpm, filename, ...) do { header = headerRead(fd, HEADER_MAGIC_YES); if (header != NULL) { - struct s_Package pkg, *_pkg; + struct s_Package *_pkg; SV *sv_pkg; - memset(&pkg, 0, sizeof(struct s_Package)); - pkg.flag = 1 + av_len(depslist); - pkg.h = header; - sv_pkg = sv_setref_pv(newSVpvs(""), "URPM::Package", - _pkg = memcpy(malloc(sizeof(struct s_Package)), &pkg, sizeof(struct s_Package))); + _pkg = calloc(1, sizeof(struct s_Package)); + _pkg->flag = 1 + av_len(depslist); + _pkg->h = header; + sv_pkg = sv_setref_pv(newSVpvs(""), "URPM::Package", _pkg); if (call_package_callback(urpm, sv_pkg, callback)) { if (provides) { update_provides(_pkg, provides); @@ -3098,7 +3097,7 @@ Urpm_parse_rpm(urpm, filename, ...) HV *obsoletes = fobsoletes && SvROK(*fobsoletes) && SvTYPE(SvRV(*fobsoletes)) == SVt_PVHV ? (HV*)SvRV(*fobsoletes) : NULL; if (depslist != NULL) { - struct s_Package pkg, *_pkg; + struct s_Package *_pkg; SV *sv_pkg; int packing = 0; int keep_all_tags = 0; @@ -3139,9 +3138,8 @@ Urpm_parse_rpm(urpm, filename, ...) } } PUTBACK; - memset(&pkg, 0, sizeof(struct s_Package)); - pkg.flag = 1 + av_len(depslist); - _pkg = memcpy(malloc(sizeof(struct s_Package)), &pkg, sizeof(struct s_Package)); + _pkg = calloc(1, sizeof(struct s_Package)); + _pkg->flag = 1 + av_len(depslist); if (update_header(filename, _pkg, keep_all_tags, vsflags)) { sv_pkg = sv_setref_pv(newSVpvs(""), "URPM::Package", _pkg); |