uploaded spice-vdagent
[platform/adaptation/emulator/spice-vdagent.git] / src / glib-compat.h
1 /*  glib-compat.h
2
3     Copyright 2013 Red Hat, Inc.
4
5     Red Hat Authors:
6     Hans de Goede <hdegoede@redhat.com>
7
8     This program is free software: you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or   
11     (at your option) any later version.
12
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of 
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
16     GNU General Public License for more details.
17
18     You should have received a copy of the GNU General Public License
19     along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 */
21 #ifndef __GLIB_COMPAT_H
22 #define __GLIB_COMPAT_H
23
24 #include <glib.h>
25
26 #if !GLIB_CHECK_VERSION(2,26,0)
27 static inline guint64 g_key_file_get_uint64(GKeyFile *file,
28     const gchar *group, const gchar *key, GError **error)
29 {
30     gchar *val_str;
31     guint64 val = 0;
32
33     val_str = g_key_file_get_value(file, group, key, error);
34     if (val_str) {
35         val = g_ascii_strtoull(val_str, NULL, 10);
36         g_free(val_str);
37     }
38
39     return val;
40 }
41 #endif
42
43 #endif