Deleted Added
full compact
hash.c (89857) hash.c (104834)
1/* hash.c -- hash table routines for BFD
1/* hash.c -- hash table routines for BFD
2 Copyright 1993, 1994, 1995, 1997, 1999, 2001
2 Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002
3 Free Software Foundation, Inc.
4 Written by Steve Chamberlain <sac@cygnus.com>
5
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or

--- 359 unchanged lines hidden (view full) ---

370
371 hash = 0;
372 len = 0;
373 s = (const unsigned char *) string;
374 while ((c = *s++) != '\0')
375 {
376 hash += c + (c << 17);
377 hash ^= hash >> 2;
3 Free Software Foundation, Inc.
4 Written by Steve Chamberlain <sac@cygnus.com>
5
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2 of the License, or

--- 359 unchanged lines hidden (view full) ---

370
371 hash = 0;
372 len = 0;
373 s = (const unsigned char *) string;
374 while ((c = *s++) != '\0')
375 {
376 hash += c + (c << 17);
377 hash ^= hash >> 2;
378 ++len;
379 }
378 }
379 len = (s - (const unsigned char *) string) - 1;
380 hash += len + (len << 17);
381 hash ^= hash >> 2;
382
383 index = hash % table->size;
384 for (hashp = table->table[index];
385 hashp != (struct bfd_hash_entry *) NULL;
386 hashp = hashp->next)
387 {

--- 14 unchanged lines hidden (view full) ---

402
403 new = (char *) objalloc_alloc ((struct objalloc *) table->memory,
404 len + 1);
405 if (!new)
406 {
407 bfd_set_error (bfd_error_no_memory);
408 return (struct bfd_hash_entry *) NULL;
409 }
380 hash += len + (len << 17);
381 hash ^= hash >> 2;
382
383 index = hash % table->size;
384 for (hashp = table->table[index];
385 hashp != (struct bfd_hash_entry *) NULL;
386 hashp = hashp->next)
387 {

--- 14 unchanged lines hidden (view full) ---

402
403 new = (char *) objalloc_alloc ((struct objalloc *) table->memory,
404 len + 1);
405 if (!new)
406 {
407 bfd_set_error (bfd_error_no_memory);
408 return (struct bfd_hash_entry *) NULL;
409 }
410 strcpy (new, string);
410 memcpy (new, string, len + 1);
411 string = new;
412 }
413 hashp->string = string;
414 hashp->hash = hash;
415 hashp->next = table->table[index];
416 table->table[index] = hashp;
417
418 return hashp;

--- 317 unchanged lines hidden ---
411 string = new;
412 }
413 hashp->string = string;
414 hashp->hash = hash;
415 hashp->next = table->table[index];
416 table->table[index] = hashp;
417
418 return hashp;

--- 317 unchanged lines hidden ---