Skip to content

Commit

Permalink
patch 9.0.0450: return value of argument check functions is inconsistent
Browse files Browse the repository at this point in the history
Problem:    Return value of argument check functions is inconsistent.
Solution:   Return OK/FAIL instead of TRUE/FALSE. (closes #11112)
  • Loading branch information
zeertzjq authored and brammool committed Sep 12, 2022
1 parent cdc8393 commit cd2d5c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/typval.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ check_for_nonempty_string_arg(typval_T *args, int idx)
check_for_opt_string_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_string_arg(args, idx) != FAIL);
|| check_for_string_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand All @@ -434,7 +434,7 @@ check_for_number_arg(typval_T *args, int idx)
check_for_opt_number_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_number_arg(args, idx) != FAIL);
|| check_for_number_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand Down Expand Up @@ -532,7 +532,7 @@ check_for_nonnull_list_arg(typval_T *args, int idx)
check_for_opt_list_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_list_arg(args, idx) != FAIL);
|| check_for_list_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand Down Expand Up @@ -573,7 +573,7 @@ check_for_nonnull_dict_arg(typval_T *args, int idx)
check_for_opt_dict_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_dict_arg(args, idx) != FAIL);
|| check_for_dict_arg(args, idx) != FAIL) ? OK : FAIL;
}

#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
Expand All @@ -599,7 +599,7 @@ check_for_chan_or_job_arg(typval_T *args, int idx)
check_for_opt_chan_or_job_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_chan_or_job_arg(args, idx) != FAIL);
|| check_for_chan_or_job_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand All @@ -623,7 +623,7 @@ check_for_job_arg(typval_T *args, int idx)
check_for_opt_job_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_job_arg(args, idx) != FAIL);
|| check_for_job_arg(args, idx) != FAIL) ? OK : FAIL;
}
#endif

Expand All @@ -649,7 +649,7 @@ check_for_string_or_number_arg(typval_T *args, int idx)
check_for_opt_string_or_number_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_string_or_number_arg(args, idx) != FAIL);
|| check_for_string_or_number_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand All @@ -669,7 +669,7 @@ check_for_buffer_arg(typval_T *args, int idx)
check_for_opt_buffer_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_buffer_arg(args, idx));
|| check_for_buffer_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand All @@ -689,7 +689,7 @@ check_for_lnum_arg(typval_T *args, int idx)
check_for_opt_lnum_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_lnum_arg(args, idx));
|| check_for_lnum_arg(args, idx) != FAIL) ? OK : FAIL;
}

#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
Expand Down Expand Up @@ -746,7 +746,7 @@ check_for_string_or_list_or_blob_arg(typval_T *args, int idx)
check_for_opt_string_or_list_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_string_or_list_arg(args, idx));
|| check_for_string_or_list_arg(args, idx) != FAIL) ? OK : FAIL;
}

/*
Expand Down Expand Up @@ -788,7 +788,8 @@ check_for_string_or_number_or_list_arg(typval_T *args, int idx)
check_for_opt_string_or_number_or_list_arg(typval_T *args, int idx)
{
return (args[idx].v_type == VAR_UNKNOWN
|| check_for_string_or_number_or_list_arg(args, idx) != FAIL);
|| check_for_string_or_number_or_list_arg(args, idx)
!= FAIL) ? OK : FAIL;
}

/*
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
450,
/**/
449,
/**/
Expand Down

0 comments on commit cd2d5c1

Please sign in to comment.