vlib: refactor empty string checks to use s == '' or s != '', instead of s.len == 0 (#21300)

This commit is contained in:
Turiiya 2024-04-18 01:44:31 +02:00 committed by GitHub
parent 46be635072
commit 8aa9314a99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 95 additions and 96 deletions

View file

@ -36,7 +36,7 @@ fn (mut dom DocumentObjectModel) print_debug(data string) {
@[inline]
fn is_close_tag(tag &Tag) bool {
return tag.name.len > 0 && tag.name[0] == `/`
return tag.name != '' && tag.name[0] == `/`
}
fn (mut dom DocumentObjectModel) where_is(item_name string, attribute_name string) int {
@ -138,7 +138,7 @@ fn (mut dom DocumentObjectModel) construct(tag_list []&Tag) {
stack.push(root_index)
}
dom.print_debug('Removed ' + temp_string + ' -- ' + tag_list[temp_int].name)
} else if tag.name.len > 0 {
} else if tag.name != '' {
dom.add_tag_attribute(tag) // error here
dom.add_tag_by_attribute(tag)
dom.add_tag_by_type(tag)