diff options
author | Kévin THIERRY <kevin.thierry@open.eurogiciel.org> | 2014-11-05 08:27:15 +0100 |
---|---|---|
committer | Kévin THIERRY <kevin.thierry@open.eurogiciel.org> | 2014-11-05 08:27:15 +0100 |
commit | e15597c3e85dedc015ff923a88febd46a1551f71 (patch) | |
tree | 467fdb092d1fa76bcb63d4db653e8176dae24e62 /hash.c | |
parent | 9789b4dba120180760ec948089fc98ebab6eb28b (diff) | |
download | make-e15597c3e85dedc015ff923a88febd46a1551f71.tar.gz make-e15597c3e85dedc015ff923a88febd46a1551f71.tar.bz2 make-e15597c3e85dedc015ff923a88febd46a1551f71.zip |
Imported Upstream version 4.0upstream/4.0sandbox/kevinthierry/upstream
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -14,10 +14,10 @@ A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "make.h" +#include "makeint.h" #include "hash.h" -#define CALLOC(t, n) ((t *) calloc (sizeof (t), (n))) +#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n))) #define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n))) #define REALLOC(o, t, n) ((t *) xrealloc ((o), sizeof (t) * (n))) #define CLONE(o, t, n) ((t *) memcpy (MALLOC (t, (n)), (o), sizeof (t) * (n))) @@ -26,7 +26,7 @@ static void hash_rehash __P((struct hash_table* ht)); static unsigned long round_up_2 __P((unsigned long rough)); /* Implement double hashing with open addressing. The table size is - always a power of two. The secondary (`increment') hash function + always a power of two. The secondary ('increment') hash function is forced to return an odd-value, in order to be relatively prime to the table size. This guarantees that the increment can potentially hit every slot in the table during collision @@ -61,7 +61,7 @@ hash_init (struct hash_table *ht, unsigned long size, ht->ht_compare = hash_cmp; } -/* Load an array of items into `ht'. */ +/* Load an array of items into 'ht'. */ void hash_load (struct hash_table *ht, void *item_table, @@ -75,9 +75,9 @@ hash_load (struct hash_table *ht, void *item_table, } } -/* Returns the address of the table slot matching `key'. If `key' is +/* Returns the address of the table slot matching 'key'. If 'key' is not found, return the address of an empty slot suitable for - inserting `key'. The caller is responsible for incrementing + inserting 'key'. The caller is responsible for incrementing ht_fill on insertion. */ void ** |