1 /* Things needed for both reading and writing DWARF indices.
3 Copyright (C) 1994-2019 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 #include "dwarf-index-common.h"
23 /* See dwarf-index-common.h. */
26 mapped_index_string_hash (int index_version
, const void *p
)
28 const unsigned char *str
= (const unsigned char *) p
;
32 while ((c
= *str
++) != 0)
34 if (index_version
>= 5)
42 /* See dwarf-index-common.h. */
45 dwarf5_djb_hash (const char *str_
)
47 const unsigned char *str
= (const unsigned char *) str_
;
49 /* Note: tolower here ignores UTF-8, which isn't fully compliant.
50 See http://dwarfstd.org/ShowIssue.php?issue=161027.1. */
53 while (int c
= *str
++)
54 hash
= hash
* 33 + tolower (c
);