mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
updated for version 7.3.1159
Problem: The round() function is not always available. (Christ van Willegen) Solution: Use the solution from f_round().
This commit is contained in:
14
src/eval.c
14
src/eval.c
@@ -15774,6 +15774,17 @@ theend:
|
||||
}
|
||||
|
||||
#ifdef FEAT_FLOAT
|
||||
|
||||
/*
|
||||
* round() is not in C90, use ceil() or floor() instead.
|
||||
*/
|
||||
float_T
|
||||
vim_round(f)
|
||||
float_T f;
|
||||
{
|
||||
return f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
|
||||
}
|
||||
|
||||
/*
|
||||
* "round({float})" function
|
||||
*/
|
||||
@@ -15786,8 +15797,7 @@ f_round(argvars, rettv)
|
||||
|
||||
rettv->v_type = VAR_FLOAT;
|
||||
if (get_float_arg(argvars, &f) == OK)
|
||||
/* round() is not in C90, use ceil() or floor() instead. */
|
||||
rettv->vval.v_float = f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
|
||||
rettv->vval.v_float = vim_round(f);
|
||||
else
|
||||
rettv->vval.v_float = 0.0;
|
||||
}
|
||||
|
@@ -982,7 +982,7 @@ profile_divide(tm, count, tm2)
|
||||
double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count;
|
||||
|
||||
tm2->tv_sec = floor(usec / 1000000.0);
|
||||
tm2->tv_usec = round(usec - (tm2->tv_sec * 1000000.0));
|
||||
tm2->tv_usec = vim_round(usec - (tm2->tv_sec * 1000000.0));
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
@@ -75,13 +75,12 @@ int dict_add_list __ARGS((dict_T *d, char *key, list_T *list));
|
||||
dictitem_T *dict_find __ARGS((dict_T *d, char_u *key, int len));
|
||||
char_u *get_dict_string __ARGS((dict_T *d, char_u *key, int save));
|
||||
long get_dict_number __ARGS((dict_T *d, char_u *key));
|
||||
void dict_extend __ARGS((dict_T *d1, dict_T *d2, char_u *action));
|
||||
char_u *get_function_name __ARGS((expand_T *xp, int idx));
|
||||
char_u *get_expr_name __ARGS((expand_T *xp, int idx));
|
||||
char_u *get_expanded_name __ARGS((char_u *name, int check));
|
||||
int translated_function_exists __ARGS((char_u *name));
|
||||
int func_call __ARGS((char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv));
|
||||
void dict_extend __ARGS((dict_T *d1, dict_T *d2, char_u *action));
|
||||
void mzscheme_call_vim __ARGS((char_u *name, typval_T *args, typval_T *rettv));
|
||||
float_T vim_round __ARGS((float_T f));
|
||||
long do_searchpair __ARGS((char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit));
|
||||
void set_vim_var_nr __ARGS((int idx, long val));
|
||||
long get_vim_var_nr __ARGS((int idx));
|
||||
@@ -110,6 +109,8 @@ void ex_echohl __ARGS((exarg_T *eap));
|
||||
void ex_execute __ARGS((exarg_T *eap));
|
||||
void ex_function __ARGS((exarg_T *eap));
|
||||
void free_all_functions __ARGS((void));
|
||||
int translated_function_exists __ARGS((char_u *name));
|
||||
char_u *get_expanded_name __ARGS((char_u *name, int check));
|
||||
void func_dump_profile __ARGS((FILE *fd));
|
||||
char_u *get_user_func_name __ARGS((expand_T *xp, int idx));
|
||||
void ex_delfunction __ARGS((exarg_T *eap));
|
||||
|
@@ -728,6 +728,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1159,
|
||||
/**/
|
||||
1158,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user