Commit 3d55a75d authored by Geoff Simmons's avatar Geoff Simmons

test_format.c: more checking that the occupied field is set when required

(and not "by accident" for stack-local data)
parent 338795ca
...@@ -109,9 +109,11 @@ static const char ...@@ -109,9 +109,11 @@ static const char
printf("... testing get_payload()\n"); printf("... testing get_payload()\n");
memset(&rec, 0, sizeof(logline_t));
rec.magic = LOGLINE_MAGIC; rec.magic = LOGLINE_MAGIC;
rec.occupied = 1; rec.occupied = 1;
VSTAILQ_INIT(&rec.chunks); VSTAILQ_INIT(&rec.chunks);
memset(&chunk, 0, sizeof(chunk_t));
chunk.magic = CHUNK_MAGIC; chunk.magic = CHUNK_MAGIC;
chunk.data = (char *) calloc(1, config.chunk_size); chunk.data = (char *) calloc(1, config.chunk_size);
chunk.occupied = 1; chunk.occupied = 1;
...@@ -178,6 +180,7 @@ static const char ...@@ -178,6 +180,7 @@ static const char
tx.magic = TX_MAGIC; tx.magic = TX_MAGIC;
VSTAILQ_INIT(&tx.lines); VSTAILQ_INIT(&tx.lines);
for (int i = 0; i < NRECORDS; i++) { for (int i = 0; i < NRECORDS; i++) {
memset(&recs[i], 0, sizeof(logline_t));
recs[i].magic = LOGLINE_MAGIC; recs[i].magic = LOGLINE_MAGIC;
recs[i].tag = SLT_ReqHeader; recs[i].tag = SLT_ReqHeader;
recs[i].occupied = 1; recs[i].occupied = 1;
...@@ -316,8 +319,12 @@ static const char ...@@ -316,8 +319,12 @@ static const char
printf("... testing get_rec_fld()\n"); printf("... testing get_rec_fld()\n");
memset(&rec, 0, sizeof(logline_t));
memset(&chunk, 0, sizeof(chunk_t));
rec.magic = LOGLINE_MAGIC; rec.magic = LOGLINE_MAGIC;
VSTAILQ_INIT(&rec.chunks); VSTAILQ_INIT(&rec.chunks);
rec.occupied = 1;
chunk.magic = CHUNK_MAGIC; chunk.magic = CHUNK_MAGIC;
chunk.data = (char *) calloc(1, config.chunk_size); chunk.data = (char *) calloc(1, config.chunk_size);
chunk.occupied = 1; chunk.occupied = 1;
......
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