diff options
-rw-r--r-- | lasso/backward_comp.h | 48 | ||||
-rw-r--r-- | lasso/lasso.c | 16 | ||||
-rw-r--r-- | lasso/utils.h | 7 | ||||
-rw-r--r-- | tests/login_tests.c | 1 |
4 files changed, 50 insertions, 22 deletions
diff --git a/lasso/backward_comp.h b/lasso/backward_comp.h new file mode 100644 index 00000000..d4efd76b --- /dev/null +++ b/lasso/backward_comp.h @@ -0,0 +1,48 @@ +/* $Id$ + * + * Lasso - A free implementation of the Liberty Alliance specifications. + * + * Copyright (C) 2004-2007 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: See AUTHORS file in top-level directory. + * + * 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef BACKWARD_COMP_H + +/** This file contains re-implementations of functions which only exists in recent version of our + * dependencies, like GLib, OpenSSL or libxml. + */ + +/* GLIB backward-compatibility */ +#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 16) +static inline int g_strcmp0(const char *str1, const char *str2) { + if (str1 == NULL && str2 == NULL) { + return 0; + } + if (str1 == NULL) { + return -1; + } + if (str2 == NULL) { + return 1; + } + return strcmp(str1, str2); +} +#endif + +#endif diff --git a/lasso/lasso.c b/lasso/lasso.c index 2d376492..c39c196b 100644 --- a/lasso/lasso.c +++ b/lasso/lasso.c @@ -37,6 +37,7 @@ #include <config.h> #include "lasso.h" #include "debug.h" +#include "./backward_comp.h" /* Set to true, it forces lasso_provider_verify_signature and lasso_query_verify_signature to always * return TRUE. */ @@ -78,21 +79,6 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } #endif -#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 16) -static int g_strcmp0(const char *str1, const char *str2) { - if (str1 == NULL && str2 == NULL) { - return 0; - } - if (str1 == NULL) { - return -1; - } - if (str2 == NULL) { - return 1; - } - return strcmp(str1, str2); -} -#endif - #include "types.c" /** diff --git a/lasso/utils.h b/lasso/utils.h index 6fe5d02c..4766420e 100644 --- a/lasso/utils.h +++ b/lasso/utils.h @@ -372,11 +372,4 @@ /* Get a printable extract for error messages */ char* lasso_safe_prefix_string(const char *str, gsize length); -/* GLIB bacward-compatibility */ -#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 16) -int g_strcmp0 (const char *str1, - const char *str2); -#endif - - #endif /* __LASSO_UTILS_H__ */ diff --git a/tests/login_tests.c b/tests/login_tests.c index eec03584..21c1ad1d 100644 --- a/tests/login_tests.c +++ b/tests/login_tests.c @@ -29,6 +29,7 @@ #include <lasso/lasso.h> #include <glib.h> #include "utils.h" +#include "../lasso/backward_comp.h" static char* |