[libgovirt] cleanup: Adjust to GLib 2.38



commit fd051f7eeaec069336639af13a8d6e1cf0223867
Author: Fabiano FidĂȘncio <fidencio redhat com>
Date:   Fri May 13 16:27:38 2016 +0200

    cleanup: Adjust to GLib 2.38
    
    Let's remove glib-compat files and all the GLIB_CHECK_VERSION guards.

 examples/async-test.c             |   3 -
 examples/list-vms-async.c         |   2 -
 examples/list-vms.c               |   3 -
 examples/sync-test.c              |   3 -
 govirt/Makefile.am                |   2 -
 govirt/glib-compat.c              | 194 --------------------------------------
 govirt/glib-compat.h              | 152 -----------------------------
 govirt/govirt-private.h           |   1 -
 govirt/ovirt-proxy.c              |  52 ----------
 govirt/ovirt-proxy.h              |   4 -
 govirt/ovirt-resource-rest-call.c |   1 -
 govirt/ovirt-vm.h                 |   4 -
 12 files changed, 421 deletions(-)
---
diff --git a/examples/async-test.c b/examples/async-test.c
index 662e571..e5f0bff 100644
--- a/examples/async-test.c
+++ b/examples/async-test.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 
 #include <govirt/govirt.h>
-#include "govirt/glib-compat.h"
 
 static GMainLoop *main_loop;
 
@@ -294,8 +293,6 @@ static gboolean start(gpointer user_data)
 
 int main(int argc, char **argv)
 {
-    g_type_init();
-
     if (argc != 3) {
         g_print("Usage: %s URI VM-NAME\n", argv[0]);
         exit(1);
diff --git a/examples/list-vms-async.c b/examples/list-vms-async.c
index 57aefba..a979375 100644
--- a/examples/list-vms-async.c
+++ b/examples/list-vms-async.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 
 #include <govirt/govirt.h>
-#include "govirt/glib-compat.h"
 
 static GMainLoop *main_loop;
 
@@ -189,7 +188,6 @@ static gboolean start(gpointer user_data)
 int main(int argc, char **argv)
 {
     AsyncData *data;
-    g_type_init();
 
     if (argc != 2) {
         g_print("Usage: %s URI\n", argv[0]);
diff --git a/examples/list-vms.c b/examples/list-vms.c
index 6737c64..9554f79 100644
--- a/examples/list-vms.c
+++ b/examples/list-vms.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 
 #include <govirt/govirt.h>
-#include "govirt/glib-compat.h"
 
 static gboolean
 authenticate_cb(RestProxy *proxy, G_GNUC_UNUSED RestProxyAuth *auth,
@@ -100,8 +99,6 @@ int main(int argc, char **argv)
     OvirtProxy *proxy = NULL;
     GError *error = NULL;
 
-    g_type_init();
-
     if (argc != 2) {
         g_print("Usage: %s URI\n", argv[0]);
         exit(1);
diff --git a/examples/sync-test.c b/examples/sync-test.c
index 4487825..4ffec18 100644
--- a/examples/sync-test.c
+++ b/examples/sync-test.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 
 #include <govirt/govirt.h>
-#include "govirt/glib-compat.h"
 
 static const char *
 genum_get_nick (GType enum_type, gint value)
@@ -128,8 +127,6 @@ int main(int argc, char **argv)
     gchar *ticket = NULL;
     GByteArray *ca_cert = NULL;
 
-    g_type_init();
-
     if (argc != 3) {
         g_print("Usage: %s URI VM-NAME\n", argv[0]);
         exit(1);
diff --git a/govirt/Makefile.am b/govirt/Makefile.am
index c2d4a86..5d8a7cb 100644
--- a/govirt/Makefile.am
+++ b/govirt/Makefile.am
@@ -35,7 +35,6 @@ libgovirt_la_HEADERS =                                                \
        $(NULL)
 
 noinst_HEADERS =                                               \
-       glib-compat.h                                           \
        govirt-private.h                                        \
        ovirt-action-rest-call.h                                \
        ovirt-api-private.h                                     \
@@ -53,7 +52,6 @@ noinst_HEADERS =                                              \
        $(NULL)
 
 libgovirt_la_SOURCES =                                         \
-       glib-compat.c                                           \
        ovirt-action-rest-call.c                                \
        ovirt-api.c                                             \
        ovirt-cdrom.c                                           \
diff --git a/govirt/govirt-private.h b/govirt/govirt-private.h
index cd98b5b..2c0e30f 100644
--- a/govirt/govirt-private.h
+++ b/govirt/govirt-private.h
@@ -36,6 +36,5 @@
 #include <govirt/ovirt-storage-domain-private.h>
 #include <govirt/ovirt-utils.h>
 #include <govirt/ovirt-vm-private.h>
-#include <govirt/glib-compat.h>
 
 #endif /* __OVIRT_PRIVATE_H__ */
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index b51d0a3..b337d93 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -483,7 +483,6 @@ static void ovirt_proxy_set_tmp_ca_file(OvirtProxy *proxy, const char *ca_file)
 }
 
 
-#if GLIB_CHECK_VERSION(2, 32, 0)
 static char *write_to_tmp_file(const char *template,
                                const char *data,
                                gsize data_len,
@@ -519,57 +518,6 @@ end:
 
     return result;
 }
-#else
-static char *write_to_tmp_file(const char *template,
-                               const char *data,
-                               gsize data_len,
-                               GError **error)
-{
-    int fd = -1;
-    char *tmp_file = NULL;
-    char *result = NULL;
-
-    fd = g_file_open_tmp(template, &tmp_file, error);
-    if (fd == -1) {
-        goto end;
-    }
-
-    while (data_len != 0) {
-        ssize_t bytes_written;
-        bytes_written = write(fd, data, data_len);
-        if (bytes_written == -1) {
-            if ((errno != EINTR) || (errno != EAGAIN)) {
-                g_set_error(error, G_FILE_ERROR,
-                            g_file_error_from_errno(errno),
-                            _("Failed to write to '%s': %s"),
-                            tmp_file, strerror(errno));
-                goto end;
-            }
-        }
-        g_assert(bytes_written <= (ssize_t)data_len);
-        data_len -= bytes_written;
-    }
-
-    result = tmp_file;
-    tmp_file = NULL;
-
-end:
-    if (fd != -1) {
-        int close_status = close(fd);
-        if (close_status != 0) {
-            g_set_error(error, G_FILE_ERROR,
-                        g_file_error_from_errno(errno),
-                        _("Failed to close '%s': %s"),
-                        result, strerror(errno));
-            g_free(result);
-            result = NULL;
-        }
-    }
-    g_free(tmp_file);
-    return result;
-}
-#endif
-
 
 static gboolean set_ca_cert_from_data(OvirtProxy *proxy,
                                       char *ca_cert_data,
diff --git a/govirt/ovirt-proxy.h b/govirt/ovirt-proxy.h
index 2f9c2be..110fdfc 100644
--- a/govirt/ovirt-proxy.h
+++ b/govirt/ovirt-proxy.h
@@ -29,10 +29,6 @@
 
 G_BEGIN_DECLS
 
-#if !GLIB_CHECK_VERSION(2,32,0)
-#define G_DEPRECATED_FOR(name) G_GNUC_DEPRECATED_FOR(name)
-#endif
-
 #define OVIRT_TYPE_PROXY ovirt_proxy_get_type()
 
 #define OVIRT_PROXY(obj) \
diff --git a/govirt/ovirt-resource-rest-call.c b/govirt/ovirt-resource-rest-call.c
index 87892e2..e72b0e9 100644
--- a/govirt/ovirt-resource-rest-call.c
+++ b/govirt/ovirt-resource-rest-call.c
@@ -28,7 +28,6 @@
 #include <libsoup/soup.h>
 #include <rest/rest-params.h>
 
-#include "glib-compat.h"
 #include "ovirt-proxy.h"
 #include "ovirt-resource-private.h"
 #include "ovirt-resource-rest-call.h"
diff --git a/govirt/ovirt-vm.h b/govirt/ovirt-vm.h
index bef4289..7e9fa0f 100644
--- a/govirt/ovirt-vm.h
+++ b/govirt/ovirt-vm.h
@@ -30,10 +30,6 @@
 
 G_BEGIN_DECLS
 
-#if !GLIB_CHECK_VERSION(2,32,0)
-#define G_DEPRECATED_FOR(name) G_GNUC_DEPRECATED_FOR(name)
-#endif
-
 #define OVIRT_TYPE_VM            (ovirt_vm_get_type ())
 #define OVIRT_VM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), OVIRT_TYPE_VM, OvirtVm))
 #define OVIRT_VM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), OVIRT_TYPE_VM, OvirtVmClass))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]