From a4e94c3c2a564121f43d2b24da510766ec717280 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 13 Sep 2014 15:07:15 +0200 Subject: hack to make the test work without gnu c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/test/crtcinfo.c | 3 --- src/test/crtcinfo.h | 3 +++ src/test/errors.c | 6 ------ src/test/errors.h | 6 ++++++ src/test/methods.c | 5 ----- src/test/methods.h | 6 ++++++ src/test/test.c | 15 +-------------- src/test/test.h | 38 ++++++++++++++++++++++++++++++++++++++ src/test/user.c | 38 ++++++++++++++++++++++++++++++++++---- src/test/user.h | 6 ++++++ 10 files changed, 94 insertions(+), 32 deletions(-) create mode 100644 src/test/test.h (limited to 'src/test') diff --git a/src/test/crtcinfo.c b/src/test/crtcinfo.c index 54f2760..502d82a 100644 --- a/src/test/crtcinfo.c +++ b/src/test/crtcinfo.c @@ -17,9 +17,6 @@ */ #include "crtcinfo.h" -#include -#include - /** * Conditionally print a CRTC information field. diff --git a/src/test/crtcinfo.h b/src/test/crtcinfo.h index c197cd2..39f282e 100644 --- a/src/test/crtcinfo.h +++ b/src/test/crtcinfo.h @@ -21,6 +21,9 @@ #include +#include +#include + /** * The CRTC information for a CRTC. diff --git a/src/test/errors.c b/src/test/errors.c index eb0dd03..c1137ca 100644 --- a/src/test/errors.c +++ b/src/test/errors.c @@ -17,12 +17,6 @@ */ #include "errors.h" -#include - -#include -#include - - /** * The error API. diff --git a/src/test/errors.h b/src/test/errors.h index 50ed595..e3140e2 100644 --- a/src/test/errors.h +++ b/src/test/errors.h @@ -19,6 +19,12 @@ #define LIBGAMMA_TEST_ERRROS_H +#include + +#include +#include + + /** * The error API. */ diff --git a/src/test/methods.c b/src/test/methods.c index d3c5811..30dadc8 100644 --- a/src/test/methods.c +++ b/src/test/methods.c @@ -17,11 +17,6 @@ */ #include "methods.h" -#include - -#include -#include - /** * Get the name representation of an diff --git a/src/test/methods.h b/src/test/methods.h index 194485d..fd7975a 100644 --- a/src/test/methods.h +++ b/src/test/methods.h @@ -19,6 +19,12 @@ #define LIBGAMMA_TEST_METHODS_H +#include + +#include +#include + + #ifndef __GCC__ # define __attribute__(x) #endif diff --git a/src/test/test.c b/src/test/test.c index ef6e7e2..07727ac 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -15,20 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this library. If not, see . */ -#include "update-warnings.h" -#include "methods.h" -#include "errors.h" -#include "crtcinfo.h" -#include "user.h" -#include "ramps.h" - -#include - -#include -#include -#include -#include - +#include "test.h" /** diff --git a/src/test/test.h b/src/test/test.h new file mode 100644 index 0000000..97a2fb6 --- /dev/null +++ b/src/test/test.h @@ -0,0 +1,38 @@ +/** + * libgamma -- Display server abstraction layer for gamma ramp adjustments + * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This library 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 library 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 library. If not, see . + */ +#ifndef LIBGAMMA_TEST_TEST_H +#define LIBGAMMA_TEST_TEST_H + + +#include "update-warnings.h" +#include "methods.h" +#include "errors.h" +#include "crtcinfo.h" +#include "user.h" +#include "ramps.h" + +#include + +#include +#include +#include +#include + + +#endif + diff --git a/src/test/user.c b/src/test/user.c index a9980ed..f2a1d50 100644 --- a/src/test/user.c +++ b/src/test/user.c @@ -17,11 +17,41 @@ */ #include "user.h" -#include "methods.h" -#include -#include -#include +#ifdef __GCC__ +# include +#else +/* Hack to circumvent that the funcions are defined multiples. */ +# define strlen strlen_ +# define memcpy memcpy_ +# define strchr strchr_ +static size_t strlen_(const char* str) +{ + size_t n = 0; + while (str[n]) + n++; + return n; +} +static void* memcpy_(void* dest, const void* src, size_t n) +{ + char* restrict d = dest; + const char* restrict s = src; + size_t i; + for (i = 0; i < n; i++) + d[i] = s[i]; + return dest; +} +static char* strchr_(const char* s, int c) +{ + char find = (char)c; + while (*s) + if (*s == find) + return s; + else + s++; + return NULL; +} +#endif /** diff --git a/src/test/user.h b/src/test/user.h index ed47560..ffce92f 100644 --- a/src/test/user.h +++ b/src/test/user.h @@ -19,8 +19,14 @@ #define LIBGAMMA_TEST_USER_H +#include "methods.h" + #include +#include +#include + + /** * Let the user select adjustment method, site, partition and CRTC. -- cgit v1.2.3-70-g09d2