summaryrefslogtreecommitdiff
path: root/tests/test-mem-nr
diff options
context:
space:
mode:
authorJohn Millaway <john43@users.sourceforge.net>2002-07-25 00:43:47 +0000
committerJohn Millaway <john43@users.sourceforge.net>2002-07-25 00:43:47 +0000
commite9d5fc713f61be7ad4df74b38f94d4915b7daad0 (patch)
tree4abf38698b4ed345f238766379fce943444d73c4 /tests/test-mem-nr
parentfdaa843d563c582da9a9bfaf76cc2e5346b16faa (diff)
All prototypes were rewritten to depend upon the macro YY_TRADITIONAL_FUNC_DEFS, which
is defined by default. The generated scanners build cleanly under gcc's traditional strictness and under C++ compilers.
Diffstat (limited to 'tests/test-mem-nr')
-rw-r--r--tests/test-mem-nr/scanner.l11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test-mem-nr/scanner.l b/tests/test-mem-nr/scanner.l
index 7741f1d..0241ac4 100644
--- a/tests/test-mem-nr/scanner.l
+++ b/tests/test-mem-nr/scanner.l
@@ -32,6 +32,9 @@
#include "config.h"
/* Insanely small read buffer. This pretty much guarantees at least one realloc. */
+#ifdef YY_BUF_SIZE
+#undef YY_BUF_SIZE
+#endif
#define YY_BUF_SIZE 8
%}
@@ -77,7 +80,7 @@ static void dump_mem(FILE* fp){
int i;
fprintf(fp,"\tptrs[%d] = {", nptrs);
for (i=0; i < arrsz; i++)
- fprintf(fp," {%#lx,%d},", (long)ptrs[i].p, (long)ptrs[i].sz);
+ fprintf(fp," {%#lx,%ld},", (long)ptrs[i].p, (long)ptrs[i].sz);
fprintf(fp,"}\n");
}
@@ -123,7 +126,7 @@ void * yyrealloc(void* p, size_t n )
ptrs[i].sz = n;
printf("yyflex_realloc(%#10lx,%8ld) total=%8ld return=%8lx\n",
- (long)p,n,(long)total_mem,(long)ptrs[i].p);
+ (long)p,(long)n,(long)total_mem,(long)ptrs[i].p);
dump_mem(stdout);
return ptrs[i].p;
}
@@ -153,8 +156,10 @@ void yyfree(void* p )
exit(1);
}
+int main(void);
+
int
-main ( int argc, char** argv )
+main ()
{
arrsz = 1;
ptrs = (struct memsz*)calloc(1,sizeof(struct memsz));