Introduce strbegins() macro and replace all open-coded instances
This test is done quite a bit across the tree, and the open-coded variants make it easy to have an accidental mismatch between the length of the prefix being tested and the length actually passed to strncmp(). This fixes an issue of that type comparing the server version against the prefix "u2.10", where the old code used an incorrect length of 4.
This commit is contained in:
@@ -915,7 +915,7 @@ char *make_fstring_var(const char *var_name)
|
||||
if ((var = find_ext_fset_var(tmp_var)))
|
||||
return m_strdup(var->string);
|
||||
|
||||
if (!strncmp(tmp_var, "FORMAT_", 7))
|
||||
if (strbegins(tmp_var, "FORMAT_"))
|
||||
tmp_var += 7;
|
||||
if ((find_fixed_array_item (fset_array, sizeof(IrcVariable), NUMBER_OF_FSET, tmp_var, &cnt, &msv_index) == NULL))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user