From: Bruno Haible Date: Mon, 14 Mar 2005 11:17:56 +0000 (+0000) Subject: Modernize. X-Git-Tag: v0.14.3~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=610afdc4c034ebbaac0e51c37ffc228fc127ec9c;p=thirdparty%2Fgettext.git Modernize. --- diff --git a/gettext-tools/lib/ChangeLog b/gettext-tools/lib/ChangeLog index 713bab00a..cf0d4713e 100644 --- a/gettext-tools/lib/ChangeLog +++ b/gettext-tools/lib/ChangeLog @@ -2,6 +2,12 @@ * gettext-0.14.3 released. +2004-09-12 Bruno Haible + + * hash.c: Include instead of . + Assume an ANSI C implementation with stdlib.h, string.h. + (BITSPERBYTE, LONGBITS, bcopy): Remove macros. + 2005-02-24 Bruno Haible * gettext-0.14.2 released. diff --git a/gettext-tools/lib/hash.c b/gettext-tools/lib/hash.c index a4b88f459..ab3343650 100644 --- a/gettext-tools/lib/hash.c +++ b/gettext-tools/lib/hash.c @@ -1,5 +1,5 @@ /* hash - implement simple hashing table with string based keys. - Copyright (C) 1994-1995, 2000-2003 Free Software Foundation, Inc. + Copyright (C) 1994-1995, 2000-2004 Free Software Foundation, Inc. Written by Ulrich Drepper , October 1994. This program is free software; you can redistribute it and/or modify @@ -23,50 +23,19 @@ /* Specification. */ #include "hash.h" -#if STDC_HEADERS -# include -#else -# ifdef HAVE_MALLOC_H -# include -# endif -#endif - -#ifdef HAVE_STRING_H -# include -#else -# include -#endif - +#include +#include #include +#include #include -#if HAVE_OBSTACK -# include -#else -# include "obstack.h" -#endif - -#if HAVE_VALUES_H -# include -#endif +#include #include "xalloc.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -#ifndef BITSPERBYTE -# define BITSPERBYTE 8 -#endif - -#ifndef LONGBITS -# define LONGBITS (sizeof (long) * BITSPERBYTE) -#endif - -#ifndef bcopy -# define bcopy(S, D, N) memcpy ((D), (S), (N)) -#endif - typedef struct hash_entry { unsigned long used; @@ -146,7 +115,7 @@ insert_entry_2 (hash_table *htab, table[idx].keylen = keylen; table[idx].data = data; - /* List the new value in the list. */ + /* List the new value in the list. */ if ((hash_entry *) htab->first == NULL) { table[idx].next = &table[idx]; @@ -278,7 +247,7 @@ compute_hashval (const void *key, size_t keylen) hval = keylen; while (cnt < keylen) { - hval = (hval << 9) | (hval >> (LONGBITS - 9)); + hval = (hval << 9) | (hval >> (sizeof (unsigned long) * CHAR_BIT - 9)); hval += (unsigned long int) *(((const char *) key) + cnt++); } return hval != 0 ? hval : ~((unsigned long) 0);