From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D7A9D138334 for ; Tue, 31 Dec 2019 09:05:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 54ADAE0E3C; Tue, 31 Dec 2019 09:05:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D9B79E0E3B for ; Tue, 31 Dec 2019 09:05:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D21F634DDB7 for ; Tue, 31 Dec 2019 09:05:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0368E17 for ; Tue, 31 Dec 2019 09:05:49 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1577732610.acd6354c5f3b1e771bbba9cb4738c264f9e11af3.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, / X-VCS-Repository: proj/portage-utils X-VCS-Files: TODO.md libq/atom.c X-VCS-Directories: / libq/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: acd6354c5f3b1e771bbba9cb4738c264f9e11af3 X-VCS-Branch: master Date: Tue, 31 Dec 2019 09:05:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f91d02d1-5ddb-4f86-b7dc-1ff6205d39b6 X-Archives-Hash: 212cb00a715ef7d3ecb31bbf84d4f5f0 commit: acd6354c5f3b1e771bbba9cb4738c264f9e11af3 Author: Fabian Groffen gentoo org> AuthorDate: Mon Dec 30 19:03:30 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Mon Dec 30 19:03:30 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=acd6354c libq/atom: slightly improve atom_explode Use malloc iso zalloc and only clear the struct bit of the allocation. Signed-off-by: Fabian Groffen gentoo.org> TODO.md | 5 ----- libq/atom.c | 5 +++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index f4775eb..b0bac64 100644 --- a/TODO.md +++ b/TODO.md @@ -21,17 +21,12 @@ - implement our own iniparser so we *can* be dep-free -- add applet/functionality to view latest version of package in tree - (functionality necessary for upgrade in qmerge, easy printing would - also allow to use q instead of eix from Puppet provider) - # Atoms - only 32bit values are supported for revision (-r#) - only 64bit values are supported in any individual version component foo-(1234)\_alpha(56789) - these limits should not be an issue for all practical purposes -- remove zalloc from atom explode (just initialise what needs to) - make PVR match PMS https://dev.gentoo.org/~ulm/pms/head/pms.html#x1-10800011 # qmerge diff --git a/libq/atom.c b/libq/atom.c index 6f65c8b..05b138c 100644 --- a/libq/atom.c +++ b/libq/atom.c @@ -54,8 +54,9 @@ atom_explode(const char *atom) * PVR needs 3 extra bytes for possible implicit '-r0'. */ slen = strlen(atom); len = sizeof(*ret) + (slen + 1) * sizeof(*atom) * 3 + 3; - ret = xzalloc(len); - ptr = (char*)ret; + ret = xmalloc(len); + memset(ret, '\0', sizeof(*ret)); + ptr = (char *)ret; ret->P = ptr + sizeof(*ret); ret->PVR = ret->P + slen + 1; ret->CATEGORY = ret->PVR + slen + 1 + 3;