Commit 785cf499 authored by Geoff Simmons's avatar Geoff Simmons

trackrdrd: use unsigned indexes in data init (large tables were overflowing)

parent 99de8f95
......@@ -609,7 +609,7 @@ static inline dataentry
de->tid = fd;
de->hasdata = false;
sprintf(de->data, "XID=%d", xid);
sprintf(de->data, "XID=%u", xid);
de->end = strlen(de->data);
if (de->end > dtbl.w_stats.data_hi)
dtbl.w_stats.data_hi = de->end;
......
......@@ -53,13 +53,13 @@ DATA_Init(void)
dataentry *entryptr;
char *bufptr;
int bufsize = config.maxdata;
unsigned bufsize = config.maxdata;
/*
* we want enough space to accomodate all open and done records
*
*/
int entries = (1 << config.maxopen_scale) + config.maxdone;
unsigned entries = (1 << config.maxopen_scale) + config.maxdone;
entryptr = (dataentry *) calloc(entries, sizeof(dataentry));
if (entryptr == NULL)
......@@ -82,7 +82,7 @@ DATA_Init(void)
dtbl.buf = bufptr;
dtbl.nfree = 0;
for (int i = 0; i < entries; i++) {
for (unsigned i = 0; i < entries; i++) {
dtbl.entry[i].magic = DATA_MAGIC;
dtbl.entry[i].state = DATA_EMPTY;
dtbl.entry[i].hasdata = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment