diff options
author | Hans de Goede <hans@localhost.localdomain> | 2013-04-10 14:31:43 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-04-10 17:48:54 +0200 |
commit | 60ce72321b1144826c624f8e587c1809c3a7a989 (patch) | |
tree | b88fef4d1793a1df14beca5ab1fe32c514b3d664 /src | |
parent | a9433024879dd8860adea273e606757bcdc7ba1b (diff) | |
download | vd_agent-60ce72321b1144826c624f8e587c1809c3a7a989.tar.gz vd_agent-60ce72321b1144826c624f8e587c1809c3a7a989.tar.xz vd_agent-60ce72321b1144826c624f8e587c1809c3a7a989.zip |
Add glib-compat.h to fix building with glib < 2.28
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/glib-compat.h | 43 | ||||
-rw-r--r-- | src/vdagent-file-xfers.c | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/glib-compat.h b/src/glib-compat.h new file mode 100644 index 0000000..623b6de --- /dev/null +++ b/src/glib-compat.h @@ -0,0 +1,43 @@ +/* glib-compat.h + + Copyright 2013 Red Hat, Inc. + + Red Hat Authors: + Hans de Goede <hdegoede@redhat.com> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef __GLIB_COMPAT_H +#define __GLIB_COMPAT_H + +#include <glib.h> + +#if !GLIB_CHECK_VERSION(2,26,0) +static inline guint64 g_key_file_get_uint64(GKeyFile *file, + const gchar *group, const gchar *key, GError **error) +{ + gchar *val_str; + guint64 val = 0; + + val_str = g_key_file_get_value(file, group, key, error); + if (val_str) { + val = g_ascii_strtoull(val_str, NULL, 10); + g_free(val_str); + } + + return val; +} +#endif + +#endif diff --git a/src/vdagent-file-xfers.c b/src/vdagent-file-xfers.c index 8242a27..b792282 100644 --- a/src/vdagent-file-xfers.c +++ b/src/vdagent-file-xfers.c @@ -38,6 +38,7 @@ #include "vdagentd-proto.h" #include "vdagent-file-xfers.h" +#include "glib-compat.h" struct vdagent_file_xfers { GHashTable *xfers; |