xref: /netbsd-src/external/gpl3/gdb/dist/gdbsupport/gdb-hashtab.cc (revision ccd9df534e375a4366c5b55f23782053c7a98d82)
1 /* Hash table wrappers for gdb.
2    Copyright (C) 2021-2023 Free Software Foundation, Inc.
3 
4    This file is part of GDB.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18 
19 #include "common-defs.h"
20 #include "gdb-hashtab.h"
21 
22 /* Allocation function for the libiberty hash table which uses an
23    obstack.  The obstack is passed as DATA.  */
24 
25 void *
26 hashtab_obstack_allocate (void *data, size_t size, size_t count)
27 {
28   size_t total = size * count;
29   void *ptr = obstack_alloc ((struct obstack *) data, total);
30 
31   memset (ptr, 0, total);
32   return ptr;
33 }
34 
35 /* Trivial deallocation function for the libiberty splay tree and hash
36    table - don't deallocate anything.  Rely on later deletion of the
37    obstack.  DATA will be the obstack, although it is not needed
38    here.  */
39 
40 void
41 dummy_obstack_deallocate (void *object, void *data)
42 {
43   return;
44 }
45