mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.2928: the evalfunc.c file is too big
Problem: The evalfunc.c file is too big. Solution: Move float related functionality to a separate file. (Yegappan Lakshmanan, closes #8287)
This commit is contained in:
committed by
Bram Moolenaar
parent
a83d06026d
commit
01c798c31a
37
src/eval.c
37
src/eval.c
@@ -5155,43 +5155,6 @@ string_quote(char_u *str, int function)
|
||||
return s;
|
||||
}
|
||||
|
||||
#if defined(FEAT_FLOAT) || defined(PROTO)
|
||||
/*
|
||||
* Convert the string "text" to a floating point number.
|
||||
* This uses strtod(). setlocale(LC_NUMERIC, "C") has been used to make sure
|
||||
* this always uses a decimal point.
|
||||
* Returns the length of the text that was consumed.
|
||||
*/
|
||||
int
|
||||
string2float(
|
||||
char_u *text,
|
||||
float_T *value) // result stored here
|
||||
{
|
||||
char *s = (char *)text;
|
||||
float_T f;
|
||||
|
||||
// MS-Windows does not deal with "inf" and "nan" properly.
|
||||
if (STRNICMP(text, "inf", 3) == 0)
|
||||
{
|
||||
*value = INFINITY;
|
||||
return 3;
|
||||
}
|
||||
if (STRNICMP(text, "-inf", 3) == 0)
|
||||
{
|
||||
*value = -INFINITY;
|
||||
return 4;
|
||||
}
|
||||
if (STRNICMP(text, "nan", 3) == 0)
|
||||
{
|
||||
*value = NAN;
|
||||
return 3;
|
||||
}
|
||||
f = strtod(s, &s);
|
||||
*value = f;
|
||||
return (int)((char_u *)s - text);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert the specified byte index of line 'lnum' in buffer 'buf' to a
|
||||
* character index. Works only for loaded buffers. Returns -1 on failure.
|
||||
|
Reference in New Issue
Block a user