* [Qemu-devel] [PATCH] target-arm: Avoid g_hash_table_get_keys()
@ 2013-07-01 11:40 Peter Maydell
2013-07-01 11:52 ` Laurent Desnogues
2013-07-09 3:58 ` Peter Crosthwaite
0 siblings, 2 replies; 3+ messages in thread
From: Peter Maydell @ 2013-07-01 11:40 UTC (permalink / raw)
To: qemu-devel; +Cc: patches
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 <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 5f639fd..7cd3be8 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Avoid g_hash_table_get_keys()
2013-07-01 11:40 [Qemu-devel] [PATCH] target-arm: Avoid g_hash_table_get_keys() Peter Maydell
@ 2013-07-01 11:52 ` Laurent Desnogues
2013-07-09 3:58 ` Peter Crosthwaite
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Desnogues @ 2013-07-01 11:52 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel@nongnu.org, patches
On Mon, Jul 1, 2013 at 1:40 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Thanks,
Laurent
> ---
> 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 5f639fd..7cd3be8 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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Avoid g_hash_table_get_keys()
2013-07-01 11:40 [Qemu-devel] [PATCH] target-arm: Avoid g_hash_table_get_keys() Peter Maydell
2013-07-01 11:52 ` Laurent Desnogues
@ 2013-07-09 3:58 ` Peter Crosthwaite
1 sibling, 0 replies; 3+ messages in thread
From: Peter Crosthwaite @ 2013-07-09 3:58 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-devel, patches
On Mon, Jul 1, 2013 at 9:40 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
Tested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
> 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 5f639fd..7cd3be8 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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-09 3:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-01 11:40 [Qemu-devel] [PATCH] target-arm: Avoid g_hash_table_get_keys() Peter Maydell
2013-07-01 11:52 ` Laurent Desnogues
2013-07-09 3:58 ` Peter Crosthwaite
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).