eval: Refactor get_tv_lnum_buf

This commit is contained in:
ZyX
2016-08-28 08:18:29 +03:00
parent 7ee5cc7429
commit 1b3e13da5b
2 changed files with 29 additions and 23 deletions

View File

@@ -2026,6 +2026,7 @@ bool tv_check_str_or_nr(const typval_T *const tv)
///
/// @return Line number or -1 or 0.
linenr_T tv_get_lnum(const typval_T *const tv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
linenr_T lnum = get_tv_number_chk(tv, NULL);
if (lnum == 0) { // No valid number, try using same function as line() does.
@@ -2046,6 +2047,7 @@ linenr_T tv_get_lnum(const typval_T *const tv)
///
/// @return Floating-point value of the variable or zero.
float_T tv_get_float(const typval_T *const tv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
switch (tv->v_type) {
case VAR_NUMBER: {