comparison src/eval.c @ 27018:268f6a3511df v8.2.4038

patch 8.2.4038: various code not used when features are disabled Commit: https://github.com/vim/vim/commit/748b308eebe8d8860888eb27da08333f175d547d Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Sat Jan 8 12:41:16 2022 +0000 patch 8.2.4038: various code not used when features are disabled Problem: Various code not used when features are disabled. Solution: Add #ifdefs. (Dominique Pell?, closes https://github.com/vim/vim/issues/9491)
author Bram Moolenaar <Bram@vim.org>
date Sat, 08 Jan 2022 13:45:04 +0100
parents 4b8d836db103
children c9474ae175f4
comparison
equal deleted inserted replaced
27017:da790d50f73d 27018:268f6a3511df
652 652
653 return ret; 653 return ret;
654 } 654 }
655 655
656 /* 656 /*
657 * Call Vim script function "func" and return the result as a number.
658 * Returns -1 when calling the function fails.
659 * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] should
660 * have type VAR_UNKNOWN.
661 */
662 varnumber_T
663 call_func_retnr(
664 char_u *func,
665 int argc,
666 typval_T *argv)
667 {
668 typval_T rettv;
669 varnumber_T retval;
670
671 if (call_vim_function(func, argc, argv, &rettv) == FAIL)
672 return -1;
673
674 retval = tv_get_number_chk(&rettv, NULL);
675 clear_tv(&rettv);
676 return retval;
677 }
678
679 /*
680 * Call Vim script function like call_func_retnr() and drop the result.
681 * Returns FAIL when calling the function fails.
682 */
683 int
684 call_func_noret(
685 char_u *func,
686 int argc,
687 typval_T *argv)
688 {
689 typval_T rettv;
690
691 if (call_vim_function(func, argc, argv, &rettv) == FAIL)
692 return FAIL;
693 clear_tv(&rettv);
694 return OK;
695 }
696
697 /*
698 * Call Vim script function "func" and return the result as a string. 657 * Call Vim script function "func" and return the result as a string.
699 * Uses "argv" and "argc" as call_func_retnr(). 658 * Uses "argv[0]" to "argv[argc - 1]" for the function arguments. "argv[argc]"
659 * should have type VAR_UNKNOWN.
700 * Returns NULL when calling the function fails. 660 * Returns NULL when calling the function fails.
701 */ 661 */
702 void * 662 void *
703 call_func_retstr( 663 call_func_retstr(
704 char_u *func, 664 char_u *func,
716 return retval; 676 return retval;
717 } 677 }
718 678
719 /* 679 /*
720 * Call Vim script function "func" and return the result as a List. 680 * Call Vim script function "func" and return the result as a List.
721 * Uses "argv" and "argc" as call_func_retnr(). 681 * Uses "argv" and "argc" as call_func_retstr().
722 * Returns NULL when there is something wrong. 682 * Returns NULL when there is something wrong.
723 */ 683 */
724 void * 684 void *
725 call_func_retlist( 685 call_func_retlist(
726 char_u *func, 686 char_u *func,
4781 } 4741 }
4782 4742
4783 return abort; 4743 return abort;
4784 } 4744 }
4785 4745
4746 #if defined(FEAT_LUA) || defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) \
4747 || defined(PROTO)
4786 /* 4748 /*
4787 * Mark a dict and its items with "copyID". 4749 * Mark a dict and its items with "copyID".
4788 * Returns TRUE if setting references failed somehow. 4750 * Returns TRUE if setting references failed somehow.
4789 */ 4751 */
4790 int 4752 int
4795 d->dv_copyID = copyID; 4757 d->dv_copyID = copyID;
4796 return set_ref_in_ht(&d->dv_hashtab, copyID, NULL); 4758 return set_ref_in_ht(&d->dv_hashtab, copyID, NULL);
4797 } 4759 }
4798 return FALSE; 4760 return FALSE;
4799 } 4761 }
4762 #endif
4800 4763
4801 /* 4764 /*
4802 * Mark a list and its items with "copyID". 4765 * Mark a list and its items with "copyID".
4803 * Returns TRUE if setting references failed somehow. 4766 * Returns TRUE if setting references failed somehow.
4804 */ 4767 */