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

Use NEW() and NEW_SPACE() macros.

Rev: src/write_buffer.c:1.9
parent 3b81558d
...@@ -33,7 +33,7 @@ static int do_write(struct abstract_write **w, ...@@ -33,7 +33,7 @@ static int do_write(struct abstract_write **w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct write_buffer *closure = (struct write_buffer *) *w; struct write_buffer *closure = (struct write_buffer *) *w;
struct node *new; struct buffer_node *new;
MDEBUG(closure); MDEBUG(closure);
...@@ -50,7 +50,7 @@ static int do_write(struct abstract_write **w, ...@@ -50,7 +50,7 @@ static int do_write(struct abstract_write **w,
} }
/* Enqueue packet */ /* Enqueue packet */
new = xalloc(sizeof(struct node)); NEW_SPACE(new);
new->packet = packet; new->packet = packet;
new->next = 0; new->next = 0;
...@@ -136,7 +136,7 @@ int write_buffer_pre_write(struct write_buffer *buffer) ...@@ -136,7 +136,7 @@ int write_buffer_pre_write(struct write_buffer *buffer)
else else
{ {
/* Dequeue a packet, if possible */ /* Dequeue a packet, if possible */
struct node *n = buffer->head; struct buffer_node *n = buffer->head;
if (n) if (n)
{ {
buffer->partial = n->packet; buffer->partial = n->packet;
...@@ -163,7 +163,9 @@ void write_buffer_close(struct write_buffer *buffer) ...@@ -163,7 +163,9 @@ void write_buffer_close(struct write_buffer *buffer)
struct write_buffer *write_buffer_alloc(UINT32 size) struct write_buffer *write_buffer_alloc(UINT32 size)
{ {
struct write_buffer *res = xalloc(sizeof(struct write_buffer) - 1 + size*2); struct write_buffer *res;
NEW(res);
res->super.write = do_write; res->super.write = do_write;
......
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