From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UylSf-0001ql-CL for qemu-devel@nongnu.org; Mon, 15 Jul 2013 12:17:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UylSc-0002TQ-LA for qemu-devel@nongnu.org; Mon, 15 Jul 2013 12:17:17 -0400 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:58657 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UylSc-0002TM-F7 for qemu-devel@nongnu.org; Mon, 15 Jul 2013 12:17:14 -0400 From: Peter Maydell Date: Mon, 15 Jul 2013 17:17:02 +0100 Message-Id: <1373905022-27735-9-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1373905022-27735-1-git-send-email-peter.maydell@linaro.org> References: <1373905022-27735-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 8/8] target-arm: Avoid g_hash_table_get_keys() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Aurelien Jarno , Blue Swirl Cc: Anthony Liguori , qemu-devel@nongnu.org, Paul Brook g_hash_table_get_keys() was only introduced in glib 2.14, and we're still targeting a minimum version of 2.12. Rewrite the offending code (introduced in commit 721fae1) to use g_hash_table_foreach() to build the list of keys. Signed-off-by: Peter Maydell Tested-by: Laurent Desnogues Tested-by: Peter Crosthwaite Message-id: 1372678819-8633-1-git-send-email-peter.maydell@linaro.org --- target-arm/helper.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 57fa8c8..aeae024 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -222,15 +222,23 @@ static gint cpreg_key_compare(gconstpointer a, gconstpointer b) return aidx - bidx; } +static void cpreg_make_keylist(gpointer key, gpointer value, gpointer udata) +{ + GList **plist = udata; + + *plist = g_list_prepend(*plist, key); +} + void init_cpreg_list(ARMCPU *cpu) { /* Initialise the cpreg_tuples[] array based on the cp_regs hash. * Note that we require cpreg_tuples[] to be sorted by key ID. */ - GList *keys; + GList *keys = NULL; int arraylen; - keys = g_hash_table_get_keys(cpu->cp_regs); + g_hash_table_foreach(cpu->cp_regs, cpreg_make_keylist, &keys); + keys = g_list_sort(keys, cpreg_key_compare); cpu->cpreg_array_len = 0; -- 1.7.9.5