1 /* Hash table wrappers for gdb. 2 Copyright (C) 2021-2024 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 "gdb-hashtab.h" 20 21 /* Allocation function for the libiberty hash table which uses an 22 obstack. The obstack is passed as DATA. */ 23 24 void * 25 hashtab_obstack_allocate (void *data, size_t size, size_t count) 26 { 27 size_t total = size * count; 28 void *ptr = obstack_alloc ((struct obstack *) data, total); 29 30 memset (ptr, 0, total); 31 return ptr; 32 } 33 34 /* Trivial deallocation function for the libiberty splay tree and hash 35 table - don't deallocate anything. Rely on later deletion of the 36 obstack. DATA will be the obstack, although it is not needed 37 here. */ 38 39 void 40 dummy_obstack_deallocate (void *object, void *data) 41 { 42 return; 43 } 44