From b15feb70240a4fdf88ae1a7da85e6f87523e00ed Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 31 Jul 2017 17:20:18 -0700 Subject: [PATCH] Clean up some constants. And actually test an assertion rather than just state it in a comment. Bug: N/A Test: ran tests Change-Id: I07699483aca4aac4e089d8b99123cb5bde9b3c63 --- libc/include/stdio.h | 9 ++++----- tests/stdio_test.cpp | 5 +++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libc/include/stdio.h b/libc/include/stdio.h index b103990d6..72f83fb02 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -105,12 +105,11 @@ extern FILE __sF[] __REMOVED_IN(23); * stdio can provide without attempting to allocate further resources * (which could fail). Do not use this for anything. */ +#define FOPEN_MAX 20 +#define FILENAME_MAX 4096 -#define FOPEN_MAX 20 /* must be <= OPEN_MAX */ -#define FILENAME_MAX 1024 /* must be <= PATH_MAX */ - -#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ -#define TMP_MAX 308915776 +#define L_tmpnam 4096 +#define TMP_MAX 308915776 /* * Functions defined in ANSI C standard. diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp index dac7056e2..1bb97a361 100644 --- a/tests/stdio_test.cpp +++ b/tests/stdio_test.cpp @@ -1918,3 +1918,8 @@ TEST(STDIO_TEST, freopen_append_mode_and_ftell) { ASSERT_EQ(0, fclose(fp)); AssertFileIs(tf.filename, "0123456789xxx"); } + +TEST(STDIO_TEST, constants) { + ASSERT_LE(FILENAME_MAX, PATH_MAX); + ASSERT_EQ(L_tmpnam, PATH_MAX); +}