From d85a5daf253cfae20df8dde7fe6699cc830b7cf5 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sat, 23 Feb 2002 03:57:26 +0000 Subject: [PATCH] Indicate that the bcache functions don't change the strings they're passed. * bcache.h (bcache, hash): Add `const' keywords to declarations. * bcache.c (bcache, hash): Add `const' keywords to definitions. --- gdb/ChangeLog | 7 +++++++ gdb/bcache.c | 4 ++-- gdb/bcache.h | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cdca5139f0..f70f65a99a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2002-02-22 Jim Blandy + + Indicate that the bcache functions don't change the strings + they're passed. + * bcache.h (bcache, hash): Add `const' keywords to declarations. + * bcache.c (bcache, hash): Add `const' keywords to definitions. + 2002-02-22 Pierre Muller * win32-nat.c (child_create_inferior): Fix create flags setting bug. diff --git a/gdb/bcache.c b/gdb/bcache.c index 0f9c2a25cc..753a916d2e 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -33,7 +33,7 @@ */ unsigned long -hash(void *addr, int length) +hash(const void *addr, int length) { const unsigned char *k, *e; unsigned long h; @@ -127,7 +127,7 @@ expand_hash_table (struct bcache *bcache) 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. */ void * -bcache (void *addr, int length, struct bcache *bcache) +bcache (const void *addr, int length, struct bcache *bcache) { int hash_index; struct bstring *s; diff --git a/gdb/bcache.h b/gdb/bcache.h index 6b32c577d4..2b03ead5a3 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -113,7 +113,7 @@ 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 (void *addr, int length, struct bcache *bcache); +extern void *bcache (const void *addr, int length, struct bcache *bcache); /* Free all the storage that BCACHE refers to. The result is a valid, but empty, bcache. This does not free BCACHE itself, since that @@ -126,5 +126,5 @@ extern void free_bcache (struct bcache *bcache); `printf_filtered' and its ilk. */ extern void print_bcache_statistics (struct bcache *bcache, char *type); /* The hash function */ -extern unsigned long hash(void *addr, int length); +extern unsigned long hash(const void *addr, int length); #endif /* BCACHE_H */