Skip to contentSkip to conversation

qga/main.c: Don't use g_key_file_get/set_int64

PATCH Applied Peter Crosthwaite 4 participants 4 messages Mar 15, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qga/main.c: Don't use g_key_file_get/set_int64

These functions don't exist until glib version 2.26. QEMU is currently only mandating glib 2.12.

This patch replaces the functions with g_key_file_get/set_integer.

Unbreaks the build on Ubuntu 10.04 and RHEL 5.6.

Regression was introduced by 39097daf15c42243742667607d2cad2c9dc4f764

---
 qga/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qga/main.c +2 -2
index 99346e1..74ef788 100644
@@ -755,7 +755,7 @@ static void persistent_state_from_keyfile(GAPersistentState *pstate,
 
     if (g_key_file_has_key(keyfile, "global", "fd_counter", NULL)) {
         pstate->fd_counter =
-            g_key_file_get_int64(keyfile, "global", "fd_counter", NULL);
+            g_key_file_get_integer(keyfile, "global", "fd_counter", NULL);
     }
 }
 
@@ -765,7 +765,7 @@ static void persistent_state_to_keyfile(const GAPersistentState *pstate,
     g_assert(pstate);
     g_assert(keyfile);
 
-    g_key_file_set_int64(keyfile, "global", "fd_counter", pstate->fd_counter);
+    g_key_file_set_integer(keyfile, "global", "fd_counter", pstate->fd_counter);
 }
 
 static gboolean write_persistent_state(const GAPersistentState *pstate,
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Peter Crosthwaite

These functions don't exist until glib version 2.26. QEMU is currently only mandating glib 2.12.

This patch replaces the functions with g_key_file_get/set_integer.

Unbreaks the build on Ubuntu 10.04 and RHEL 5.6.

Regression was introduced by 39097daf15c42243742667607d2cad2c9dc4f764

Thanks, this fixes the build for me on openSUSE 11.1 as well.

I also applied to patch to ppc-next, as I can't build without it, but I'd prefer if someone applies the patch directly to the tree ASAP.

Alex

Quoted 30 lines

---
qga/main.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
qga/main.c +2 -2
index 99346e1..74ef788 100644
@@ -755,7 +755,7 @@ static void persistent_state_from_keyfile(GAPersistentState *pstate,
 
    if (g_key_file_has_key(keyfile, "global", "fd_counter", NULL)) {
        pstate->fd_counter =
-            g_key_file_get_int64(keyfile, "global", "fd_counter", NULL);
+            g_key_file_get_integer(keyfile, "global", "fd_counter", NULL);
    }
 }
 
@@ -765,7 +765,7 @@ static void persistent_state_to_keyfile(const GAPersistentState *pstate,
    g_assert(pstate);
    g_assert(keyfile);
 
-    g_key_file_set_int64(keyfile, "global", "fd_counter", pstate->fd_counter);
+    g_key_file_set_integer(keyfile, "global", "fd_counter", pstate->fd_counter);
 }
 
 static gboolean write_persistent_state(const GAPersistentState *pstate,
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#2 lore raw
In reply to Peter Crosthwaite
Quoted 10 lines · Peter Crosthwaite

These functions don't exist until glib version 2.26. QEMU is currently only mandating glib 2.12.

This patch replaces the functions with g_key_file_get/set_integer.

Unbreaks the build on Ubuntu 10.04 and RHEL 5.6.

Regression was introduced by 39097daf15c42243742667607d2cad2c9dc4f764

This introduces a corner-case case when fd_counter reaches MAX_INT32 and the agent is restarted, but since that's not likely to occur any time soon, let's fix
the build now, and I can send a follow-up afterward.

Quoted 29 lines
---
 qga/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
qga/main.c +2 -3
index 99346e1..74ef788 100644
@@ -755,7 +755,7 @@ static void persistent_state_from_keyfile(GAPersistentState *pstate,
 
     if (g_key_file_has_key(keyfile, "global", "fd_counter", NULL)) {
         pstate->fd_counter =
-            g_key_file_get_int64(keyfile, "global", "fd_counter", NULL);
+            g_key_file_get_integer(keyfile, "global", "fd_counter", NULL);
     }
 }
 
@@ -765,7 +765,7 @@ static void persistent_state_to_keyfile(const GAPersistentState *pstate,
     g_assert(pstate);
     g_assert(keyfile);
 
-    g_key_file_set_int64(keyfile, "global", "fd_counter", pstate->fd_counter);
+    g_key_file_set_integer(keyfile, "global", "fd_counter", pstate->fd_counter);
 }
 
 static gboolean write_persistent_state(const GAPersistentState *pstate,
--

1.7.0.4