Core: add an header file for backward compatibility

* lasso/backward_comp.h:
   this header will contain substitue function, defines or types for
   compatibility with older versions of dependencies.
 * lasso/utils.h:
   remove declaration of g_strcmp0
 * lasso.c:
 * tests/login_tests.c:
   use backward_comp.h
This commit is contained in:
Benjamin Dauvergne 2009-04-14 07:51:22 +00:00
parent 699f72e568
commit 3cd463c4a2
4 changed files with 50 additions and 22 deletions

48
lasso/backward_comp.h Normal file
View File

@ -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

View File

@ -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"
/**

View File

@ -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__ */

View File

@ -29,6 +29,7 @@
#include <lasso/lasso.h>
#include <glib.h>
#include "utils.h"
#include "../lasso/backward_comp.h"
static char*