Introduce sc_arg_max() helper

Just a cast and an assert.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2019-05-21 10:57:23 +02:00
parent 77599f06e1
commit 21c491e106
4 changed files with 15 additions and 13 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ bool env_value_is_valid(const char *e) {
* either. Discounting the shortest possible variable name of
* length 1, the equal sign and trailing NUL this hence leaves
* ARG_MAX-3 as longest possible variable value. */
if (strlen(e) > (size_t) sysconf(_SC_ARG_MAX) - 3)
if (strlen(e) > sc_arg_max() - 3)
return false;
return true;
@@ -95,7 +95,7 @@ bool env_assignment_is_valid(const char *e) {
* be > ARG_MAX, hence the individual variable assignments
* cannot be either, but let's leave room for one trailing NUL
* byte. */
if (strlen(e) > (size_t) sysconf(_SC_ARG_MAX) - 1)
if (strlen(e) > sc_arg_max() - 1)
return false;
return true;