OLD | NEW |
1 /* hash.c -- hash table routines for BFD | 1 /* hash.c -- hash table routines for BFD |
2 Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005, | 2 Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005, |
3 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. | 3 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. |
4 Written by Steve Chamberlain <sac@cygnus.com> | 4 Written by Steve Chamberlain <sac@cygnus.com> |
5 | 5 |
6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return hashp; | 531 return hashp; |
532 } | 532 } |
533 | 533 |
534 newtable = ((struct bfd_hash_entry **) | 534 newtable = ((struct bfd_hash_entry **) |
535 objalloc_alloc ((struct objalloc *) table->memory, alloc)); | 535 objalloc_alloc ((struct objalloc *) table->memory, alloc)); |
536 if (newtable == NULL) | 536 if (newtable == NULL) |
537 { | 537 { |
538 table->frozen = 1; | 538 table->frozen = 1; |
539 return hashp; | 539 return hashp; |
540 } | 540 } |
541 memset ((PTR) newtable, 0, alloc); | 541 memset (newtable, 0, alloc); |
542 | 542 |
543 for (hi = 0; hi < table->size; hi ++) | 543 for (hi = 0; hi < table->size; hi ++) |
544 while (table->table[hi]) | 544 while (table->table[hi]) |
545 { | 545 { |
546 struct bfd_hash_entry *chain = table->table[hi]; | 546 struct bfd_hash_entry *chain = table->table[hi]; |
547 struct bfd_hash_entry *chain_end = chain; | 547 struct bfd_hash_entry *chain_end = chain; |
548 | 548 |
549 while (chain_end->next && chain_end->next->hash == chain->hash) | 549 while (chain_end->next && chain_end->next->hash == chain->hash) |
550 chain_end = chain_end->next; | 550 chain_end = chain_end->next; |
551 | 551 |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2) | 902 if (bfd_bwrite ((void *) buf, (bfd_size_type) 2, abfd) != 2) |
903 return FALSE; | 903 return FALSE; |
904 } | 904 } |
905 | 905 |
906 if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len) | 906 if (bfd_bwrite ((void *) str, (bfd_size_type) len, abfd) != len) |
907 return FALSE; | 907 return FALSE; |
908 } | 908 } |
909 | 909 |
910 return TRUE; | 910 return TRUE; |
911 } | 911 } |
OLD | NEW |