diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-04-04 15:16:54 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-04-04 15:16:54 +0100 |
commit | 4829c1c9e9095a3303caec9af7d02f6547f6df0e (patch) | |
tree | 2b3819cd2ea17b652ba29f3a8a6ea9945ec6c4bb /src/evalwindow.c | |
parent | 7a411a306f90339d8686e42ac16e1ae4fc7533c5 (diff) |
patch 8.2.4683: verbose check with dict_find() to see if a key is presentv8.2.4683
Problem: Verbose check with dict_find() to see if a key is present.
Solution: Add dict_has_key(). (Yegappan Lakshmanan, closes #10074)
Diffstat (limited to 'src/evalwindow.c')
-rw-r--r-- | src/evalwindow.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/evalwindow.c b/src/evalwindow.c index a47a0c0470..f6bc79f9e8 100644 --- a/src/evalwindow.c +++ b/src/evalwindow.c @@ -1220,27 +1220,27 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED) emsg(_(e_invalid_argument)); else { - if (dict_find(dict, (char_u *)"lnum", -1) != NULL) + if (dict_has_key(dict, "lnum")) curwin->w_cursor.lnum = (linenr_T)dict_get_number(dict, (char_u *)"lnum"); - if (dict_find(dict, (char_u *)"col", -1) != NULL) + if (dict_has_key(dict, "col")) curwin->w_cursor.col = (colnr_T)dict_get_number(dict, (char_u *)"col"); - if (dict_find(dict, (char_u *)"coladd", -1) != NULL) + if (dict_has_key(dict, "coladd")) curwin->w_cursor.coladd = (colnr_T)dict_get_number(dict, (char_u *)"coladd"); - if (dict_find(dict, (char_u *)"curswant", -1) != NULL) + if (dict_has_key(dict, "curswant")) { curwin->w_curswant = (colnr_T)dict_get_number(dict, (char_u *)"curswant"); curwin->w_set_curswant = FALSE; } - if (dict_find(dict, (char_u *)"topline", -1) != NULL) + if (dict_has_key(dict, "topline")) set_topline(curwin, (linenr_T)dict_get_number(dict, (char_u *)"topline")); #ifdef FEAT_DIFF - if (dict_find(dict, (char_u *)"topfill", -1) != NULL) + if (dict_has_key(dict, "topfill")) curwin->w_topfill = (int)dict_get_number(dict, (char_u *)"topfill"); #endif - if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) + if (dict_has_key(dict, "leftcol")) curwin->w_leftcol = (colnr_T)dict_get_number(dict, (char_u *)"leftcol"); - if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) + if (dict_has_key(dict, "skipcol")) curwin->w_skipcol = (colnr_T)dict_get_number(dict, (char_u *)"skipcol"); check_cursor(); |