Use has_prefix() instead of strncmp() throughout

This is safer than hardcoded string lengths.
This commit is contained in:
Simon Ser 2025-01-07 13:21:56 +01:00 committed by Kenny Levinsen
parent c55dff95bc
commit 0c60d1581f
19 changed files with 44 additions and 49 deletions

View file

@ -300,7 +300,7 @@ struct input_config *store_input_config(struct input_config *ic,
return NULL;
}
bool type = strncmp(ic->identifier, "type:", strlen("type:")) == 0;
bool type = has_prefix(ic->identifier, "type:");
if (type && error && !validate_type_on_existing(ic, error)) {
return NULL;
}