Commit 4170bb32 authored by Niels Möller's avatar Niels Möller
Browse files

Use pointer and explicit allocation instead of buffer at the end of a


Rev: src/randomness.c:1.7
Rev: src/write_buffer.h:1.10
parent cfb2789b
......@@ -36,7 +36,7 @@ struct poor_random
struct randomness super;
struct hash_instance *hash;
UINT32 pos;
UINT8 buffer[1];
UINT8 *buffer;
static void do_poor_random(struct randomness **r, UINT32 length, UINT8 *dst)
......@@ -80,6 +80,7 @@ struct randomness *make_poor_random(struct hash_algorithm *hash,
self->super.random = do_poor_random;
self->hash = MAKE_HASH(hash);
self->buffer = lsh_space_alloc(hash->hash_size);
HASH_UPDATE(self->hash, sizeof(now), (UINT8 *) &now);
HASH_UPDATE(self->hash, init->length, init->data);
......@@ -42,6 +42,7 @@ struct write_buffer
struct abstract_write super;
UINT32 block_size;
UINT8 *buffer; /* Size is twice the blocksize */
int empty;
......@@ -60,7 +61,6 @@ struct write_buffer
UINT32 start;
UINT32 end;
UINT8 buffer[1]; /* Real size is twice the blocksize */
struct write_buffer *write_buffer_alloc(UINT32 size);
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