X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fcpphash.c;h=737ac39ef112d14955f1702f2d7a3096c9e4840c;hb=b554e3475e7ca28b6306ebf9b0c8aa7c5b977795;hp=cb435b4bd43c50155fee8fe3126b86996b0711e4;hpb=52bc7ca9c1a4480e618bae5ab5d93f14feedd173;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/cpphash.c b/gcc/cpphash.c index cb435b4bd43..737ac39ef11 100644 --- a/gcc/cpphash.c +++ b/gcc/cpphash.c @@ -1,5 +1,5 @@ /* Part of CPP library. (Macro hash table support.) - Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1986, 87, 89, 92-95, 1996 Free Software Foundation, Inc. Written by Per Bothner, 1994. Based on CCCP program by by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -16,7 +16,7 @@ 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, write to the Free Software -Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve @@ -24,24 +24,13 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #include "cpplib.h" #include "cpphash.h" +#include "gansidecl.h" extern char *xmalloc PARAMS ((unsigned)); -/* Define a generic NULL if one hasn't already been defined. */ +/* Return hash function on name. must be compatible with the one + computed a step at a time, elsewhere */ -#ifndef NULL -#define NULL 0 -#endif - -#ifndef __STDC__ -#define const -#define volatile -#endif - -/* - * return hash function on name. must be compatible with the one - * computed a step at a time, elsewhere - */ int hashf (name, len, hashsize) register const U_CHAR *name; @@ -56,19 +45,18 @@ hashf (name, len, hashsize) return MAKE_POS (r) % hashsize; } -/* - * find the most recent hash node for name name (ending with first - * non-identifier char) installed by install - * - * If LEN is >= 0, it is the length of the name. - * Otherwise, compute the length by scanning the entire name. - * - * If HASH is >= 0, it is the precomputed hash code. - * Otherwise, compute the hash code. - */ +/* Find the most recent hash node for name name (ending with first + non-identifier char) installed by install + + If LEN is >= 0, it is the length of the name. + Otherwise, compute the length by scanning the entire name. + + If HASH is >= 0, it is the precomputed hash code. + Otherwise, compute the hash code. */ + HASHNODE * cpp_lookup (pfile, name, len, hash) - struct parse_file *pfile; + cpp_reader *pfile; const U_CHAR *name; int len; int hash; @@ -91,7 +79,7 @@ cpp_lookup (pfile, name, len, hash) return bucket; bucket = bucket->next; } - return (HASHNODE*) 0; + return (HASHNODE *) 0; } /* @@ -119,7 +107,7 @@ delete_macro (hp) hp->next->prev = hp->prev; /* make sure that the bucket chain header that - the deleted guy was on points to the right thing afterwards. */ + the deleted guy was on points to the right thing afterwards. */ if (hp == *hp->bucket_hdr) *hp->bucket_hdr = hp->next; @@ -140,20 +128,20 @@ delete_macro (hp) free (hp); } -/* - * install a name in the main hash table, even if it is already there. - * name stops with first non alphanumeric, except leading '#'. - * caller must check against redefinition if that is desired. - * delete_macro () removes things installed by install () in fifo order. - * this is important because of the `defined' special symbol used - * in #if, and also if pushdef/popdef directives are ever implemented. - * - * If LEN is >= 0, it is the length of the name. - * Otherwise, compute the length by scanning the entire name. - * - * If HASH is >= 0, it is the precomputed hash code. - * Otherwise, compute the hash code. - */ + +/* Install a name in the main hash table, even if it is already there. + name stops with first non alphanumeric, except leading '#'. + caller must check against redefinition if that is desired. + delete_macro () removes things installed by install () in fifo order. + this is important because of the `defined' special symbol used + in #if, and also if pushdef/popdef directives are ever implemented. + + If LEN is >= 0, it is the length of the name. + Otherwise, compute the length by scanning the entire name. + + If HASH is >= 0, it is the precomputed hash code. + Otherwise, compute the hash code. */ + HASHNODE * install (name, len, type, ivalue, value, hash) U_CHAR *name;