X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fbcache.h;h=a52f932f21bcd8247f71b262beda3e18aa5f9e18;hb=ffda88b4801e1ea163e7eb0962008c60f353c229;hp=6c3a63d2ba882ff4814b66cbb077323f3da78b12;hpb=49df298f1fa4f80404f5dc1b496335abb924953e;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/bcache.h b/gdb/bcache.h index 6c3a63d2ba..a52f932f21 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -2,13 +2,14 @@ Written by Fred Fish Rewritten by Jim Blandy - Copyright 1999, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1999-2000, 2002-2003, 2007-2012 Free Software + Foundation, Inc. This file is part of GDB. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,9 +18,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, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + along with this program. If not, see . */ #ifndef BCACHE_H #define BCACHE_H 1 @@ -143,14 +142,25 @@ struct bcache; /* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has never seen those bytes before, add a copy of them to BCACHE. In - either case, return a pointer to BCACHE's copy of that string. */ -extern void *bcache (const void *addr, int length, struct bcache *bcache); + either case, return a pointer to BCACHE's copy of that string. + Since the cached value is ment to be read-only, return a const + buffer. */ +extern const void *bcache (const void *addr, int length, + struct bcache *bcache); + +/* Like bcache, but if ADDED is not NULL, set *ADDED to true if the + bytes were newly added to the cache, or to false if the bytes were + found in the cache. */ +extern const void *bcache_full (const void *addr, int length, + struct bcache *bcache, int *added); /* Free all the storage used by BCACHE. */ extern void bcache_xfree (struct bcache *bcache); /* Create a new bcache object. */ -extern struct bcache *bcache_xmalloc (void); +extern struct bcache *bcache_xmalloc ( + unsigned long (*hash_function)(const void *, int length), + int (*compare_function)(const void *, const void *, int length)); /* Print statistics on BCACHE's memory usage and efficacity at eliminating duplication. TYPE should be a string describing the @@ -159,7 +169,9 @@ extern struct bcache *bcache_xmalloc (void); extern void print_bcache_statistics (struct bcache *bcache, char *type); extern int bcache_memory_used (struct bcache *bcache); -/* The hash function */ +/* The hash functions */ extern unsigned long hash(const void *addr, int length); +extern unsigned long hash_continue (const void *addr, int length, + unsigned long h); #endif /* BCACHE_H */