mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-04 11:50:29 +01:00
[script] Don't segfault when hashing empty strings.
Check for the empty string.
This commit is contained in:
parent
4ba77f7765
commit
620028fd19
1 changed files with 7 additions and 4 deletions
|
|
@ -221,12 +221,15 @@ static unsigned long
|
|||
_intern_string_hash (const char *str, int len)
|
||||
{
|
||||
const signed char *p = (const signed char *) str;
|
||||
unsigned int h = *p;
|
||||
if (len > 0) {
|
||||
unsigned int h = *p;
|
||||
|
||||
for (p += 1; --len; p++)
|
||||
h = (h << 5) - h + *p;
|
||||
while (--len)
|
||||
h = (h << 5) - h + *++p;
|
||||
|
||||
return h;
|
||||
return h;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static cairo_bool_t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue