Skip to content

Commit cd2d5c1

Browse files
zeertzjqbrammool
authored andcommitted
patch 9.0.0450: return value of argument check functions is inconsistent
Problem: Return value of argument check functions is inconsistent. Solution: Return OK/FAIL instead of TRUE/FALSE. (closes #11112)
1 parent cdc8393 commit cd2d5c1

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/typval.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ check_for_nonempty_string_arg(typval_T *args, int idx)
410410
check_for_opt_string_arg(typval_T *args, int idx)
411411
{
412412
return (args[idx].v_type == VAR_UNKNOWN
413-
|| check_for_string_arg(args, idx) != FAIL);
413+
|| check_for_string_arg(args, idx) != FAIL) ? OK : FAIL;
414414
}
415415

416416
/*
@@ -434,7 +434,7 @@ check_for_number_arg(typval_T *args, int idx)
434434
check_for_opt_number_arg(typval_T *args, int idx)
435435
{
436436
return (args[idx].v_type == VAR_UNKNOWN
437-
|| check_for_number_arg(args, idx) != FAIL);
437+
|| check_for_number_arg(args, idx) != FAIL) ? OK : FAIL;
438438
}
439439

440440
/*
@@ -532,7 +532,7 @@ check_for_nonnull_list_arg(typval_T *args, int idx)
532532
check_for_opt_list_arg(typval_T *args, int idx)
533533
{
534534
return (args[idx].v_type == VAR_UNKNOWN
535-
|| check_for_list_arg(args, idx) != FAIL);
535+
|| check_for_list_arg(args, idx) != FAIL) ? OK : FAIL;
536536
}
537537

538538
/*
@@ -573,7 +573,7 @@ check_for_nonnull_dict_arg(typval_T *args, int idx)
573573
check_for_opt_dict_arg(typval_T *args, int idx)
574574
{
575575
return (args[idx].v_type == VAR_UNKNOWN
576-
|| check_for_dict_arg(args, idx) != FAIL);
576+
|| check_for_dict_arg(args, idx) != FAIL) ? OK : FAIL;
577577
}
578578

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

605605
/*
@@ -623,7 +623,7 @@ check_for_job_arg(typval_T *args, int idx)
623623
check_for_opt_job_arg(typval_T *args, int idx)
624624
{
625625
return (args[idx].v_type == VAR_UNKNOWN
626-
|| check_for_job_arg(args, idx) != FAIL);
626+
|| check_for_job_arg(args, idx) != FAIL) ? OK : FAIL;
627627
}
628628
#endif
629629

@@ -649,7 +649,7 @@ check_for_string_or_number_arg(typval_T *args, int idx)
649649
check_for_opt_string_or_number_arg(typval_T *args, int idx)
650650
{
651651
return (args[idx].v_type == VAR_UNKNOWN
652-
|| check_for_string_or_number_arg(args, idx) != FAIL);
652+
|| check_for_string_or_number_arg(args, idx) != FAIL) ? OK : FAIL;
653653
}
654654

655655
/*
@@ -669,7 +669,7 @@ check_for_buffer_arg(typval_T *args, int idx)
669669
check_for_opt_buffer_arg(typval_T *args, int idx)
670670
{
671671
return (args[idx].v_type == VAR_UNKNOWN
672-
|| check_for_buffer_arg(args, idx));
672+
|| check_for_buffer_arg(args, idx) != FAIL) ? OK : FAIL;
673673
}
674674

675675
/*
@@ -689,7 +689,7 @@ check_for_lnum_arg(typval_T *args, int idx)
689689
check_for_opt_lnum_arg(typval_T *args, int idx)
690690
{
691691
return (args[idx].v_type == VAR_UNKNOWN
692-
|| check_for_lnum_arg(args, idx));
692+
|| check_for_lnum_arg(args, idx) != FAIL) ? OK : FAIL;
693693
}
694694

695695
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
@@ -746,7 +746,7 @@ check_for_string_or_list_or_blob_arg(typval_T *args, int idx)
746746
check_for_opt_string_or_list_arg(typval_T *args, int idx)
747747
{
748748
return (args[idx].v_type == VAR_UNKNOWN
749-
|| check_for_string_or_list_arg(args, idx));
749+
|| check_for_string_or_list_arg(args, idx) != FAIL) ? OK : FAIL;
750750
}
751751

752752
/*
@@ -788,7 +788,8 @@ check_for_string_or_number_or_list_arg(typval_T *args, int idx)
788788
check_for_opt_string_or_number_or_list_arg(typval_T *args, int idx)
789789
{
790790
return (args[idx].v_type == VAR_UNKNOWN
791-
|| check_for_string_or_number_or_list_arg(args, idx) != FAIL);
791+
|| check_for_string_or_number_or_list_arg(args, idx)
792+
!= FAIL) ? OK : FAIL;
792793
}
793794

794795
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ static char *(features[]) =
703703

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
450,
706708
/**/
707709
449,
708710
/**/

0 commit comments

Comments
 (0)