mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 23:31:51 +00:00
refactor: the long goodbye
long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
This commit is contained in:
@@ -1167,14 +1167,14 @@ long getdigits_long(char **pp, bool strict, long def)
|
||||
/// Gets a int32_t number from a string.
|
||||
///
|
||||
/// @see getdigits
|
||||
int32_t getdigits_int32(char **pp, bool strict, long def)
|
||||
int32_t getdigits_int32(char **pp, bool strict, int32_t def)
|
||||
{
|
||||
intmax_t number = getdigits(pp, strict, def);
|
||||
#if SIZEOF_INTMAX_T > 4
|
||||
if (strict) {
|
||||
assert(number >= INT32_MIN && number <= INT32_MAX);
|
||||
} else if (!(number >= INT32_MIN && number <= INT32_MAX)) {
|
||||
return (int32_t)def;
|
||||
return def;
|
||||
}
|
||||
#endif
|
||||
return (int32_t)number;
|
||||
|
Reference in New Issue
Block a user