diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-09-13 15:07:15 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-09-13 15:07:15 +0200 |
commit | a4e94c3c2a564121f43d2b24da510766ec717280 (patch) | |
tree | f4194e8148607eba6496bb93b0c885ea9f1ca862 /src | |
parent | m (diff) | |
download | libgamma-a4e94c3c2a564121f43d2b24da510766ec717280.tar.gz libgamma-a4e94c3c2a564121f43d2b24da510766ec717280.tar.bz2 libgamma-a4e94c3c2a564121f43d2b24da510766ec717280.tar.xz |
hack to make the test work without gnu c
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/test/crtcinfo.c | 3 | ||||
-rw-r--r-- | src/test/crtcinfo.h | 3 | ||||
-rw-r--r-- | src/test/errors.c | 6 | ||||
-rw-r--r-- | src/test/errors.h | 6 | ||||
-rw-r--r-- | src/test/methods.c | 5 | ||||
-rw-r--r-- | src/test/methods.h | 6 | ||||
-rw-r--r-- | src/test/test.c | 15 | ||||
-rw-r--r-- | src/test/test.h | 38 | ||||
-rw-r--r-- | src/test/user.c | 38 | ||||
-rw-r--r-- | src/test/user.h | 6 |
10 files changed, 94 insertions, 32 deletions
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 <stdio.h> -#include <stdlib.h> - /** * 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 <libgamma.h> +#include <stdio.h> +#include <stdlib.h> + /** * 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 <libgamma.h> - -#include <stdio.h> -#include <errno.h> - - /** * 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 <libgamma.h> + +#include <stdio.h> +#include <errno.h> + + /** * 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 <libgamma.h> - -#include <stdio.h> -#include <stdlib.h> - /** * 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 <libgamma.h> + +#include <stdio.h> +#include <stdlib.h> + + #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 <http://www.gnu.org/licenses/>. */ -#include "update-warnings.h" -#include "methods.h" -#include "errors.h" -#include "crtcinfo.h" -#include "user.h" -#include "ramps.h" - -#include <libgamma.h> - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <stdint.h> - +#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 <http://www.gnu.org/licenses/>. + */ +#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 <libgamma.h> + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <stdint.h> + + +#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 <stdio.h> -#include <stdlib.h> -#include <string.h> +#ifdef __GCC__ +# include <string.h> +#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 <libgamma.h> +#include <stdio.h> +#include <stdlib.h> + + /** * Let the user select adjustment method, site, partition and CRTC. |