* src/makeint.h: Compute INTSTR_LENGTH based on size of intmax_t

Math suggested by Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Paul Smith 2021-12-19 14:48:26 -05:00
parent 7192d0ec4a
commit c90db9276a

View File

@ -461,9 +461,13 @@ extern int unixy_shell;
#define STOP_SET(_v,_m) ANY_SET(stopchar_map[(unsigned char)(_v)],(_m)) #define STOP_SET(_v,_m) ANY_SET(stopchar_map[(unsigned char)(_v)],(_m))
/* True if C is whitespace but not newline. */
#define ISBLANK(c) STOP_SET((c),MAP_BLANK) #define ISBLANK(c) STOP_SET((c),MAP_BLANK)
/* True if C is whitespace including newlines. */
#define ISSPACE(c) STOP_SET((c),MAP_SPACE) #define ISSPACE(c) STOP_SET((c),MAP_SPACE)
/* True if C is nul or whitespace (including newline). */
#define END_OF_TOKEN(c) STOP_SET((c),MAP_SPACE|MAP_NUL) #define END_OF_TOKEN(c) STOP_SET((c),MAP_SPACE|MAP_NUL)
/* Move S past all whitespace (including newlines). */
#define NEXT_TOKEN(s) while (ISSPACE (*(s))) ++(s) #define NEXT_TOKEN(s) while (ISSPACE (*(s))) ++(s)
/* We can't run setrlimit when using posix_spawn. */ /* We can't run setrlimit when using posix_spawn. */
@ -479,12 +483,15 @@ extern struct rlimit stack_limit;
#define NILF ((floc *)0) #define NILF ((floc *)0)
/* Number of characters in a string constant. Does NOT include the \0 byte. */
#define CSTRLEN(_s) (sizeof (_s)-1) #define CSTRLEN(_s) (sizeof (_s)-1)
#define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s) #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s)
/* The number of bytes needed to represent the largest integer as a string. /* The number of bytes needed to represent the largest signed and unsigned
Large enough for both the largest signed and unsigned long long. */ integers as a string.
#define INTSTR_LENGTH CSTRLEN ("18446744073709551615") Does NOT include space for \0 so be sure to add it if needed.
Math suggested by Edward Welbourne <edward.welbourne@qt.io> */
#define INTSTR_LENGTH (53 * sizeof(uintmax_t) / 22 + 2)
#define DEFAULT_TTYNAME "true" #define DEFAULT_TTYNAME "true"
#ifdef HAVE_TTYNAME #ifdef HAVE_TTYNAME