comparison src/match.c @ 31728:238ca27dbfd2 v9.0.1196

patch 9.0.1196: code is indented more than necessary Commit: https://github.com/vim/vim/commit/e8575988969579f9e1439181ae338b2ff74054a8 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Jan 14 12:32:28 2023 +0000 patch 9.0.1196: code is indented more than necessary Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11813)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Jan 2023 13:45:04 +0100
parents a52697bcffa6
children a357a624e487
comparison
equal deleted inserted replaced
31727:2b50a7f0feec 31728:238ca27dbfd2
976 } 976 }
977 977
978 if (dict_has_key(tv->vval.v_dict, "conceal")) 978 if (dict_has_key(tv->vval.v_dict, "conceal"))
979 *conceal_char = dict_get_string(tv->vval.v_dict, "conceal", FALSE); 979 *conceal_char = dict_get_string(tv->vval.v_dict, "conceal", FALSE);
980 980
981 if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) != NULL) 981 if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) == NULL)
982 { 982 return OK;
983 *win = find_win_by_nr_or_id(&di->di_tv); 983
984 if (*win == NULL) 984 *win = find_win_by_nr_or_id(&di->di_tv);
985 { 985 if (*win == NULL)
986 emsg(_(e_invalid_window_number)); 986 {
987 return FAIL; 987 emsg(_(e_invalid_window_number));
988 } 988 return FAIL;
989 } 989 }
990 990
991 return OK; 991 return OK;
992 } 992 }
993 #endif 993 #endif
1328 * "matcharg()" function 1328 * "matcharg()" function
1329 */ 1329 */
1330 void 1330 void
1331 f_matcharg(typval_T *argvars UNUSED, typval_T *rettv) 1331 f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
1332 { 1332 {
1333 if (rettv_list_alloc(rettv) == OK) 1333 if (rettv_list_alloc(rettv) != OK)
1334 { 1334 return;
1335
1335 # ifdef FEAT_SEARCH_EXTRA 1336 # ifdef FEAT_SEARCH_EXTRA
1336 int id; 1337 int id;
1337 matchitem_T *m; 1338 matchitem_T *m;
1338 1339
1339 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) 1340 if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL)
1340 return; 1341 return;
1341 1342
1342 id = (int)tv_get_number(&argvars[0]); 1343 id = (int)tv_get_number(&argvars[0]);
1343 if (id >= 1 && id <= 3) 1344 if (id >= 1 && id <= 3)
1344 { 1345 {
1345 if ((m = get_match(curwin, id)) != NULL) 1346 if ((m = get_match(curwin, id)) != NULL)
1346 { 1347 {
1347 list_append_string(rettv->vval.v_list, 1348 list_append_string(rettv->vval.v_list,
1348 syn_id2name(m->mit_hlg_id), -1); 1349 syn_id2name(m->mit_hlg_id), -1);
1349 list_append_string(rettv->vval.v_list, m->mit_pattern, -1); 1350 list_append_string(rettv->vval.v_list, m->mit_pattern, -1);
1350 } 1351 }
1351 else 1352 else
1352 { 1353 {
1353 list_append_string(rettv->vval.v_list, NULL, -1); 1354 list_append_string(rettv->vval.v_list, NULL, -1);
1354 list_append_string(rettv->vval.v_list, NULL, -1); 1355 list_append_string(rettv->vval.v_list, NULL, -1);
1355 } 1356 }
1356 } 1357 }
1357 # endif 1358 # endif
1358 }
1359 } 1359 }
1360 1360
1361 /* 1361 /*
1362 * "matchdelete()" function 1362 * "matchdelete()" function
1363 */ 1363 */