projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mgetgroups: remove dependency on realloc-gnu
[gnulib.git]
/
tests
/
test-c-stack.c
diff --git
a/tests/test-c-stack.c
b/tests/test-c-stack.c
index
fe782c9
..
24fccf3
100644
(file)
--- a/
tests/test-c-stack.c
+++ b/
tests/test-c-stack.c
@@
-1,5
+1,5
@@
/* Test of c-stack module.
/* Test of c-stack module.
- Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2006, 2008
-2013
Free Software Foundation, Inc.
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
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
@@
-20,7
+20,6
@@
#include "exitfail.h"
#include <stdio.h>
#include "exitfail.h"
#include <stdio.h>
-#include <stdlib.h>
#if HAVE_SETRLIMIT
/* At least FreeBSD 5.0 needs extra headers before <sys/resource.h>
will compile. */
#if HAVE_SETRLIMIT
/* At least FreeBSD 5.0 needs extra headers before <sys/resource.h>
will compile. */
@@
-29,27
+28,24
@@
# include <sys/resource.h>
#endif
# include <sys/resource.h>
#endif
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
+#include "macros.h"
-static long
-recurse (char *p)
+char *program_name;
+
+static volatile int *
+recurse_1 (volatile int n, volatile int *p)
{
{
- char array[500];
-
array[0] = 1
;
- return
*p + recurse (array)
;
+ if (n >= 0)
+
*recurse_1 (n + 1, p) += n
;
+ return
p
;
}
}
-char *program_name;
+static int
+recurse (volatile int n)
+{
+ int sum = 0;
+ return *recurse_1 (n, &sum);
+}
int
main (int argc, char **argv)
int
main (int argc, char **argv)
@@
-65,15
+61,16
@@
main (int argc, char **argv)
#endif
program_name = argv[0];
#endif
program_name = argv[0];
- if (c_stack_action (
0
) == 0)
+ if (c_stack_action (
NULL
) == 0)
{
if (1 < argc)
{
if (1 < argc)
- {
- exit_failure = 77;
- ++*argv[argc]; /* Intentionally dereference NULL. */
- }
- return recurse (
"\1"
);
+
{
+
exit_failure = 77;
+
++*argv[argc]; /* Intentionally dereference NULL. */
+
}
+ return recurse (
0
);
}
}
+ fputs ("skipping test: ", stderr);
perror ("c_stack_action");
return 77;
}
perror ("c_stack_action");
return 77;
}