diff --git a/ChangeLog b/ChangeLog index 966b9d60b8cefcf0114cc86d0cbea0930b4d4a5a..561476e905611f5feda7f1c6c7adcb6ae35e368e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2014-10-22 Niels Möller <nisse@lysator.liu.se> + * configure.ac: Check for getline function. + * testsuite/ed25519-test.c (getline) [!HAVE_GETLINE]: Fallback + definition. + * Makefile.in (clean-here): Unconditionally delete .so and .dll files. (IMPLICIT_TARGETS): Deleted variable. diff --git a/configure.ac b/configure.ac index 3e464e71071966f5edc16858aded1a40d3735f4f..bb33962cca1004143ccd18c49c859e0eb5e4e80e 100644 --- a/configure.ac +++ b/configure.ac @@ -647,7 +647,8 @@ AC_CHECK_HEADERS([valgrind/memcheck.h]) LSH_FUNC_ALLOCA LSH_FUNC_STRERROR - +# Used in the testsuite +AC_CHECK_FUNCS(getline) AC_C_BIGENDIAN LSH_GCC_ATTRIBUTES diff --git a/testsuite/ed25519-test.c b/testsuite/ed25519-test.c index be1313760c5500f1fb55e2bcea101a9f01d3b3ce..924ecea6e0d4a74e2797a83569035ddda8478596 100644 --- a/testsuite/ed25519-test.c +++ b/testsuite/ed25519-test.c @@ -117,6 +117,44 @@ test_one (const char *line) free (msg); } +#ifndef HAVE_GETLINE +static ssize_t +getline(char **lineptr, size_t *n, FILE *f) +{ + size_t i; + int c; + if (!*lineptr) + { + *n = 500; + *lineptr = xalloc (*n); + } + + i = 0; + do + { + c = getc(f); + if (c < 0) + { + if (i > 0) + break; + return -1; + } + + (*lineptr) [i++] = c; + if (i == *n) + { + *n *= 2; + *lineptr = realloc (*lineptr, *n); + if (!*lineptr) + die ("Virtual memory exhausted.\n"); + } + } while (c != '\n'); + + (*lineptr) [i] = 0; + return i; +} +#endif + void test_main(void) {