1 /* $Id$
2  *
3  * Lasso - A free implementation of the Liberty Alliance specifications.
4  *
5  * Copyright (C) 2004-2007 Entr'ouvert
6  * http://lasso.entrouvert.org
7  *
8  * Authors: See AUTHORS file in top-level directory.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef BACKWARD_COMP_H
26 #define BACKWARD_COMP_H 1
27 
28 /* This file contains re-implementations of functions which only exists in recent version of our
29  * dependencies, like GLib, OpenSSL or libxml.
30  */
31 
32 /* GLIB backward-compatibility */
33 #if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 16)
34 #include <string.h>
35 
g_strcmp0(const char * str1,const char * str2)36 static inline int g_strcmp0(const char *str1, const char *str2) {
37 	if (str1 == NULL && str2 == NULL) {
38 		return 0;
39 	}
40 	if (str1 == NULL) {
41 		return -1;
42 	}
43 	if (str2 == NULL) {
44 		return 1;
45 	}
46 	return strcmp(str1, str2);
47 }
48 #endif
49 
50 #endif /* BACKWARD_COMP_H */
51