no tiny buckets

This commit is contained in:
Jeff Hill
1994-11-29 22:41:12 +00:00
parent 81de80789c
commit 53b2a77378
6 changed files with 33 additions and 17 deletions

View File

@@ -15,7 +15,7 @@ SRCS.c = \
OBJS = \
calcPerform.o cvtBpt.o cvtFast.o ellLib.o envSubr.o errSymLib.o \
errSymTbl.o genSubr.o genTaskSubr.o nextFieldSubr.o postfix.o \
bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o
bucketLib.o tsSubr.o gpHashLib.o freeListLib.o pal.o paldef.o
OBJS1 = \
cmdSubr.o cvtNumbers.o cvtFast.o ezsSockSubr.o helpSubr.o

View File

@@ -34,7 +34,6 @@
* .01 Storage for identifier must persist until an item is deleted
*/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
@@ -324,7 +323,11 @@ BUCKET *bucketCreate (unsigned nHashTableEntries)
unsigned nbits;
BUCKET *pb;
if (nHashTableEntries==0) {
/*
* no absurd sized buckets
*/
if (nHashTableEntries<=1) {
fprintf (stderr, "Tiny bucket create failed\n");
return NULL;
}
@@ -337,12 +340,15 @@ BUCKET *bucketCreate (unsigned nHashTableEntries)
break;
}
}
/*
* indexWidth must be specified at least one
* bit less than the bit size of type BUCKETID
*/
if (nbits>=BUCKETID_BIT_WIDTH) {
printf("%s at %d: Requested index width=%d to large. max=%d\n",
fprintf (
stderr,
"%s at %d: Requested index width=%d to large. max=%d\n",
__FILE__,
__LINE__,
nbits,

View File

@@ -34,7 +34,6 @@
* .01 Storage for identifier must persist until an item is deleted
*/
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
@@ -324,7 +323,11 @@ BUCKET *bucketCreate (unsigned nHashTableEntries)
unsigned nbits;
BUCKET *pb;
if (nHashTableEntries==0) {
/*
* no absurd sized buckets
*/
if (nHashTableEntries<=1) {
fprintf (stderr, "Tiny bucket create failed\n");
return NULL;
}
@@ -337,12 +340,15 @@ BUCKET *bucketCreate (unsigned nHashTableEntries)
break;
}
}
/*
* indexWidth must be specified at least one
* bit less than the bit size of type BUCKETID
*/
if (nbits>=BUCKETID_BIT_WIDTH) {
printf("%s at %d: Requested index width=%d to large. max=%d\n",
fprintf (
stderr,
"%s at %d: Requested index width=%d to large. max=%d\n",
__FILE__,
__LINE__,
nbits,

View File

@@ -34,7 +34,7 @@
#include <ellLib.h>
#if !defined(NULL) || (NULL!=0)
#if !defined(NULL)
#define NULL 0
#endif

View File

@@ -34,7 +34,7 @@
#include <ellLib.h>
#if !defined(NULL) || (NULL!=0)
#if !defined(NULL)
#define NULL 0
#endif

View File

@@ -131,7 +131,7 @@ unsigned long size;
if(memDebugLevel>2){
fprintf(stderr, "%08x=malloc(%d) %s.%d\n",
pHdr->pUser, size, pFile, line);
(unsigned) pHdr->pUser, size, pFile, line);
}
return pHdr->pUser;
@@ -178,8 +178,10 @@ void *ptr;
if(status<0 || (pHdr->pUser != ptr)){
FASTUNLOCK(&memDebugLock);
fprintf(stderr, "%s.%d free(%08x) failed\n", pFile, line, ptr);
fprintf(stderr, "malloc occured at %s.%d\n", pHdr->pFile, pHdr->line);
fprintf(stderr, "%s.%d free(%08x) failed\n",
pFile, line, (unsigned) ptr);
fprintf(stderr, "malloc occured at %s.%d\n",
pHdr->pFile, pHdr->line);
assert(0);
}
ellDelete(&memDebugList, &pHdr->node);
@@ -188,7 +190,8 @@ void *ptr;
memDebugVerify(pHdr);
if(memDebugLevel>2){
fprintf(stderr, "free(%08x) %s.%d\n", ptr, pFile, line);
fprintf(stderr, "free(%08x) %s.%d\n",
(unsigned)ptr, pFile, line);
fprintf(stderr,
"\tmalloc(%d) at %s.%d\n",
pHdr->size,
@@ -215,8 +218,10 @@ DMH *pHdr;
}
if(pHdr->magic != debugMallocMagic || pHdr->pFoot->magic != debugMallocMagic){
fprintf(stderr, "block overwritten %x\n", pHdr->pUser);
fprintf(stderr, "malloc occured at %s.%d\n", pHdr->pFile, pHdr->line);
fprintf(stderr, "block overwritten %x\n",
(unsigned)pHdr->pUser);
fprintf(stderr, "malloc occured at %s.%d\n",
pHdr->pFile, pHdr->line);
return 1;
}
@@ -252,7 +257,6 @@ int memDebugPrintAll(ignoreBeforeThisTick)
unsigned long ignoreBeforeThisTick;
#endif /*__STDC__*/
{
int status;
DMH *pHdr;
FASTLOCK(&memDebugLock);
@@ -263,7 +267,7 @@ unsigned long ignoreBeforeThisTick;
}
fprintf(stderr,
"%8x = malloc(%d) at %s.%d tick=%d\n",
pHdr->pUser,
(unsigned) pHdr->pUser,
pHdr->size,
pHdr->pFile,
pHdr->line,