Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, /
Date: Tue, 31 Dec 2019 09:05:53
Message-Id: 1577732610.acd6354c5f3b1e771bbba9cb4738c264f9e11af3.grobian@gentoo
1 commit: acd6354c5f3b1e771bbba9cb4738c264f9e11af3
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Mon Dec 30 19:03:30 2019 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 30 19:03:30 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=acd6354c
7
8 libq/atom: slightly improve atom_explode
9
10 Use malloc iso zalloc and only clear the struct bit of the allocation.
11
12 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
13
14 TODO.md | 5 -----
15 libq/atom.c | 5 +++--
16 2 files changed, 3 insertions(+), 7 deletions(-)
17
18 diff --git a/TODO.md b/TODO.md
19 index f4775eb..b0bac64 100644
20 --- a/TODO.md
21 +++ b/TODO.md
22 @@ -21,17 +21,12 @@
23
24 - implement our own iniparser so we *can* be dep-free
25
26 -- add applet/functionality to view latest version of package in tree
27 - (functionality necessary for upgrade in qmerge, easy printing would
28 - also allow to use q instead of eix from Puppet provider)
29 -
30 # Atoms
31
32 - only 32bit values are supported for revision (-r#)
33 - only 64bit values are supported in any individual version component
34 foo-(1234)\_alpha(56789)
35 - these limits should not be an issue for all practical purposes
36 -- remove zalloc from atom explode (just initialise what needs to)
37 - make PVR match PMS https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-10800011
38
39 # qmerge
40
41 diff --git a/libq/atom.c b/libq/atom.c
42 index 6f65c8b..05b138c 100644
43 --- a/libq/atom.c
44 +++ b/libq/atom.c
45 @@ -54,8 +54,9 @@ atom_explode(const char *atom)
46 * PVR needs 3 extra bytes for possible implicit '-r0'. */
47 slen = strlen(atom);
48 len = sizeof(*ret) + (slen + 1) * sizeof(*atom) * 3 + 3;
49 - ret = xzalloc(len);
50 - ptr = (char*)ret;
51 + ret = xmalloc(len);
52 + memset(ret, '\0', sizeof(*ret));
53 + ptr = (char *)ret;
54 ret->P = ptr + sizeof(*ret);
55 ret->PVR = ret->P + slen + 1;
56 ret->CATEGORY = ret->PVR + slen + 1 + 3;