comparison src/screen.c @ 33821:6c92d6f3a255 v9.0.2126

patch 9.0.2126: unused assignments when checking 'listchars' Commit: https://github.com/vim/vim/commit/00624a2fa08d04bdded240d474e9cfdc193dbe10 Author: zeertzjq <zeertzjq@outlook.com> Date: Thu Nov 23 20:47:16 2023 +0100 patch 9.0.2126: unused assignments when checking 'listchars' Problem: Unused assignments when checking the value of 'listchars'. Solution: Loop only once when just checking the value. Add a test to check that this change doesn't cause double-free. closes: #13559 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 23 Nov 2023 21:00:04 +0100
parents b140246564f4
children 36843e079f64
comparison
equal deleted inserted replaced
33820:83aac5eb0612 33821:6c92d6f3a255
4724 if (wp->w_p_fcs[0] == NUL) 4724 if (wp->w_p_fcs[0] == NUL)
4725 value = p_fcs; // local value is empty, us the global value 4725 value = p_fcs; // local value is empty, us the global value
4726 } 4726 }
4727 4727
4728 // first round: check for valid value, second round: assign values 4728 // first round: check for valid value, second round: assign values
4729 for (round = 0; round <= 1; ++round) 4729 for (round = 0; round <= (apply ? 1 : 0); ++round)
4730 { 4730 {
4731 if (round > 0) 4731 if (round > 0)
4732 { 4732 {
4733 // After checking that the value is valid: set defaults. 4733 // After checking that the value is valid: set defaults.
4734 if (is_listchars) 4734 if (is_listchars)
4911 else 4911 else
4912 { 4912 {
4913 wp->w_fill_chars = fill_chars; 4913 wp->w_fill_chars = fill_chars;
4914 } 4914 }
4915 } 4915 }
4916 else if (is_listchars)
4917 {
4918 vim_free(lcs_chars.multispace);
4919 vim_free(lcs_chars.leadmultispace);
4920 }
4921 4916
4922 return NULL; // no error 4917 return NULL; // no error
4923 } 4918 }
4924 4919
4925 /* 4920 /*