public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage-utils:master commit in: libq/, /
Date: Sat, 28 Nov 2015 02:44:35 +0000 (UTC)	[thread overview]
Message-ID: <1448666345.7a07798e6a7ce183ed53e6ad19d0c3a7205aae52.vapier@gentoo> (raw)

commit:     7a07798e6a7ce183ed53e6ad19d0c3a7205aae52
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 27 23:19:05 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Nov 27 23:19:05 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7a07798e

main: optimize portdir setup slightly

 libq/xarray.c | 6 ++++--
 main.c        | 9 +++------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/libq/xarray.c b/libq/xarray.c
index 56f04da..339d759 100644
--- a/libq/xarray.c
+++ b/libq/xarray.c
@@ -24,11 +24,13 @@ typedef struct {
 #define array_cnt(arr) (arr)->num
 #define DECLARE_ARRAY(arr) array_t _##arr = array_init_decl, *arr = &_##arr
 
-static void xarraypush(array_t *arr, const void *ele, size_t ele_len)
+static void *xarraypush(array_t *arr, const void *ele, size_t ele_len)
 {
+	void *nele;
 	size_t n = arr->num++;
 	arr->eles = xrealloc_array(arr->eles, arr->num, sizeof(ele));
-	arr->eles[n] = xmemdup(ele, ele_len);
+	arr->eles[n] = nele = xmemdup(ele, ele_len);
+	return nele;
 }
 #define xarraypush_str(arr, ele) xarraypush(arr, ele, strlen(ele) + 1 /*NUL*/)
 

diff --git a/main.c b/main.c
index 42a3f26..9361b98 100644
--- a/main.c
+++ b/main.c
@@ -445,12 +445,9 @@ static void read_one_repos_conf(const char *repos_conf)
 		xasprintf(&conf, "%s:location", repo);
 		path = iniparser_getstring(dict, conf, NULL);
 		if (path) {
-			if (main_repo && !strcmp(repo, main_repo)) {
-				free(portdir);
-				portdir = xstrdup(path);
-			}
-
-			xarraypush_str(overlays, path);
+			void *ele = xarraypush_str(overlays, path);
+			if (main_repo && !strcmp(repo, main_repo))
+				portdir = ele;
 		}
 		free(conf);
 	}


             reply	other threads:[~2015-11-28  2:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-28  2:44 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-27 19:19 [gentoo-commits] proj/portage-utils:master commit in: libq/, / Fabian Groffen
2024-03-29 10:57 Fabian Groffen
2024-01-02  7:57 Fabian Groffen
2023-02-07  8:25 Fabian Groffen
2023-02-07  8:10 Fabian Groffen
2021-08-16 13:23 Fabian Groffen
2020-02-21  8:18 Fabian Groffen
2020-01-05 13:28 Fabian Groffen
2020-01-02 11:19 Fabian Groffen
2020-01-01 19:52 Fabian Groffen
2019-12-31  9:05 Fabian Groffen
2019-12-30 17:24 Fabian Groffen
2019-12-29 13:26 Fabian Groffen
2019-12-27 16:57 Fabian Groffen
2019-07-13 10:04 Fabian Groffen
2019-06-19 10:44 Fabian Groffen
2019-06-05  9:15 Fabian Groffen
2019-05-09 20:19 Fabian Groffen
2019-05-05 18:13 Fabian Groffen
2019-04-28 15:20 Fabian Groffen
2019-03-27 20:18 Fabian Groffen
2019-03-27 10:55 Fabian Groffen
2019-03-22  9:57 Fabian Groffen
2019-03-19 20:32 Fabian Groffen
2019-03-19 20:32 Fabian Groffen
2019-03-09 18:58 Fabian Groffen
2018-03-23 11:56 Fabian Groffen
2016-12-29  2:25 Mike Frysinger
2016-11-26 23:17 Mike Frysinger
2015-02-24  1:26 Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448666345.7a07798e6a7ce183ed53e6ad19d0c3a7205aae52.vapier@gentoo \
    --to=vapier@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox