Commit 94269a22 authored by Niels Möller's avatar Niels Möller

Fallback for missing getline (used in the testsuite).

parent 8df19540
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.
......
......@@ -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
......
......@@ -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)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment