Written by Fred Fish <fnf@cygnus.com>
Rewritten by Jim Blandy <jimb@cygnus.com>
- Copyright (C) 1999, 2000, 2002, 2003, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 1999-2014 Free Software Foundation, Inc.
This file is part of GDB.
#include "defs.h"
#include "gdb_obstack.h"
#include "bcache.h"
-#include "gdb_string.h" /* For memcpy declaration */
+#include <string.h> /* For memcpy declaration */
#include "gdb_assert.h"
#include <stddef.h>
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. */
const void *
-bcache (const void *addr, int length, struct bcache *bcache)
+bcache (const void *addr, int length, struct bcache *cache)
{
- return bcache_full (addr, length, bcache, NULL);
+ return bcache_full (addr, length, cache, NULL);
}
/* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has
int length))
{
/* Allocate the bcache pre-zeroed. */
- struct bcache *b = XCALLOC (1, struct bcache);
+ struct bcache *b = XCNEW (struct bcache);
if (hash_function)
b->hash_function = hash_function;
lengths, and measure chain lengths. */
{
unsigned int b;
- int *chain_length = XCALLOC (c->num_buckets + 1, int);
- int *entry_size = XCALLOC (c->unique_count + 1, int);
+ int *chain_length = XCNEWVEC (int, c->num_buckets + 1);
+ int *entry_size = XCNEWVEC (int, c->unique_count + 1);
int stringi = 0;
occupied_buckets = 0;
printf_filtered (_(" Median entry size: %d\n"), median_entry_size);
printf_filtered ("\n");
- printf_filtered (_(" Total memory used by bcache, including overhead: %ld\n"),
+ printf_filtered (_(" \
+Total memory used by bcache, including overhead: %ld\n"),
c->structure_size);
printf_filtered (_(" Percentage memory overhead: "));
print_percentage (c->structure_size - c->unique_size, c->unique_size);