Fix a potential problem in the BFD library when accessing the Windows' nul device...
[binutils-gdb.git] / gdbsupport / gdb-hashtab.cc
blob777b30793a9688ca267071b9cc62705b4ddfd8df
1 /* Hash table wrappers for gdb.
2 Copyright (C) 2021-2023 Free Software Foundation, Inc.
4 This file is part of GDB.
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.
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.
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/>. */
19 #include "common-defs.h"
20 #include "gdb-hashtab.h"
22 /* Allocation function for the libiberty hash table which uses an
23 obstack. The obstack is passed as DATA. */
25 void *
26 hashtab_obstack_allocate (void *data, size_t size, size_t count)
28 size_t total = size * count;
29 void *ptr = obstack_alloc ((struct obstack *) data, total);
31 memset (ptr, 0, total);
32 return ptr;
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. */
40 void
41 dummy_obstack_deallocate (void *object, void *data)
43 return;