aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-06-18 17:20:46 +0000
committerThierry Vignaud <tv@mageia.org>2012-06-18 17:20:46 +0000
commitea3512477800dd3764f246b9e1950726e657c20c (patch)
treea6b53535c35fbf4ce71d7e449061129f74a8f7e5 /URPM.xs
parentaaf8972748e365e30c3b60bfe9f8f1b08351cd42 (diff)
downloadperl-URPM-ea3512477800dd3764f246b9e1950726e657c20c.tar
perl-URPM-ea3512477800dd3764f246b9e1950726e657c20c.tar.gz
perl-URPM-ea3512477800dd3764f246b9e1950726e657c20c.tar.bz2
perl-URPM-ea3512477800dd3764f246b9e1950726e657c20c.tar.xz
perl-URPM-ea3512477800dd3764f246b9e1950726e657c20c.zip
(parse_hdlist__XS,parse_rpm) simplify, reduce stack usage
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs18
1 files changed, 8 insertions, 10 deletions
diff --git a/URPM.xs b/URPM.xs
index a4a00e8..037b1eb 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -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);