From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1031465-garchives=archives.gentoo.org@lists.gentoo.org>
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 A6262138334
	for <garchives@archives.gentoo.org>; Wed, 20 Jun 2018 22:45:36 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 92720E0B14;
	Wed, 20 Jun 2018 22:45:35 +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 5A7FDE0B14
	for <gentoo-commits@lists.gentoo.org>; Wed, 20 Jun 2018 22:45:35 +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 0195F335C07
	for <gentoo-commits@lists.gentoo.org>; Wed, 20 Jun 2018 22:45:34 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id DEFDE2E8
	for <gentoo-commits@lists.gentoo.org>; Wed, 20 Jun 2018 22:45:31 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1529534701.b2f5531194e33c229462e9f52fa1d9388463f7b7.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/
X-VCS-Repository: proj/openrc
X-VCS-Files: src/librc/librc-misc.c
X-VCS-Directories: src/librc/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: b2f5531194e33c229462e9f52fa1d9388463f7b7
X-VCS-Branch: master
Date: Wed, 20 Jun 2018 22:45:31 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: d4e79595-6755-4d09-acef-55c29cd9bcbe
X-Archives-Hash: e4a1a30d95ba3dca64a253bcf52f31e7

commit:     b2f5531194e33c229462e9f52fa1d9388463f7b7
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Jun 20 22:45:01 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 22:45:01 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b2f55311

librc-misc: convert snprintf calls to xasprintf

 src/librc/librc-misc.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index 9d514bcd..178768c5 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -237,13 +237,9 @@ static void rc_config_set_value(RC_STRINGLIST *config, char *value)
 		if (token[i] == '\n')
 			token[i] = 0;
 
-		i = strlen(entry) + strlen(token) + 2;
-		newline = xmalloc(sizeof(char) * i);
-		snprintf(newline, i, "%s=%s", entry, token);
+		xasprintf(&newline, "%s=%s", entry, token);
 	} else {
-		i = strlen(entry) + 2;
-		newline = xmalloc(sizeof(char) * i);
-		snprintf(newline, i, "%s=", entry);
+		xasprintf(&newline, "%s=", entry);
 	}
 
 	replaced = false;
@@ -300,8 +296,7 @@ static RC_STRINGLIST *rc_config_kcl(RC_STRINGLIST *config)
 
 		if (value != NULL) {
 			len = varlen + strlen(value) + 2;
-			tmp = xmalloc(sizeof(char) * len);
-			snprintf(tmp, len, "%s=%s", override->value, value);
+			xasprintf(&tmp, "%s=%s", override->value, value);
 		}
 
 		/*