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

Removed extra indirection from the A_WRITE method.

Rev: src/abstract_io.h:1.17
Rev: src/blocking_write.c:1.6
Rev: src/connection.c:1.15
Rev: src/debug.c:1.15
Rev: src/encrypt.c:1.14
Rev: src/pad.c:1.17
Rev: src/unpad.c:1.13
Rev: src/write_buffer.c:1.11
parent 0c2ddc20
...@@ -58,16 +58,14 @@ struct read_handler ...@@ -58,16 +58,14 @@ struct read_handler
#define READ_HANDLER(h, read) ((h)->handler(&(h), (read))) #define READ_HANDLER(h, read) ((h)->handler(&(h), (read)))
/* May store a new handler into *w. FIXME: Is this indirection ever
* used? */
struct abstract_write struct abstract_write
{ {
struct lsh_object header; struct lsh_object header;
int (*write)(struct abstract_write **w, int (*write)(struct abstract_write *w,
struct lsh_string *packet); struct lsh_string *packet);
}; };
#define A_WRITE(f, packet) ((f)->write(&(f), (packet))) #define A_WRITE(f, packet) ((f)->write((f), (packet)))
/* A handler that passes packets on to another processor */ /* A handler that passes packets on to another processor */
struct abstract_write_pipe struct abstract_write_pipe
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
#warning blocking_write.c is obsolete #warning blocking_write.c is obsolete
static int do_write(struct abstract_write **w, static int do_write(struct abstract_write *w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct packet_blocking_write *closure struct packet_blocking_write *closure
= (struct packet_blocking_write *) *w; = (struct packet_blocking_write *) w;
UINT32 left = packet->length; UINT32 left = packet->length;
UINT8 *p = packet->data; UINT8 *p = packet->data;
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
#include "werror.h" #include "werror.h"
#include "xalloc.h" #include "xalloc.h"
static int handle_connection(struct abstract_write **w, static int handle_connection(struct abstract_write *w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct ssh_connection *closure = (struct ssh_connection *) *w; struct ssh_connection *closure = (struct ssh_connection *) w;
UINT8 msg; UINT8 msg;
if (!packet->length) if (!packet->length)
......
...@@ -38,11 +38,11 @@ struct packet_debug ...@@ -38,11 +38,11 @@ struct packet_debug
char *prefix; char *prefix;
}; };
static int do_debug(struct abstract_write **w, static int do_debug(struct abstract_write *w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct packet_debug *closure struct packet_debug *closure
= (struct packet_debug *) *w; = (struct packet_debug *) w;
MDEBUG(closure); MDEBUG(closure);
......
...@@ -36,10 +36,10 @@ struct packet_encrypt ...@@ -36,10 +36,10 @@ struct packet_encrypt
struct ssh_connection *connection; struct ssh_connection *connection;
}; };
static int do_encrypt(struct abstract_write **w, static int do_encrypt(struct abstract_write *w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct packet_encrypt *closure = (struct packet_encrypt *) *w; struct packet_encrypt *closure = (struct packet_encrypt *) w;
struct ssh_connection *connection = closure->connection; struct ssh_connection *connection = closure->connection;
struct lsh_string *new; struct lsh_string *new;
UINT8 *mac; UINT8 *mac;
......
...@@ -39,11 +39,11 @@ struct packet_pad ...@@ -39,11 +39,11 @@ struct packet_pad
struct randomness *random; struct randomness *random;
}; };
static int do_pad(struct abstract_write **w, static int do_pad(struct abstract_write *w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct packet_pad *closure struct packet_pad *closure
= (struct packet_pad *) *w; = (struct packet_pad *) w;
struct ssh_connection *connection = closure->connection; struct ssh_connection *connection = closure->connection;
struct lsh_string *new; struct lsh_string *new;
...@@ -87,8 +87,6 @@ make_packet_pad(struct abstract_write *continuation, ...@@ -87,8 +87,6 @@ make_packet_pad(struct abstract_write *continuation,
{ {
struct packet_pad *closure; struct packet_pad *closure;
MDEBUG(closure);
NEW(closure); NEW(closure);
closure->super.super.write = do_pad; closure->super.super.write = do_pad;
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
#include "format.h" #include "format.h"
#include "xalloc.h" #include "xalloc.h"
static int do_unpad(struct abstract_write **w, static int do_unpad(struct abstract_write *w,
struct lsh_string *packet) struct lsh_string *packet)
{ {
struct abstract_write_pipe *closure = (struct abstract_write_pipe *) *w; struct abstract_write_pipe *closure = (struct abstract_write_pipe *) w;
UINT8 padding_length; UINT8 padding_length;
UINT32 payload_length; UINT32 payload_length;
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
#include <assert.h> #include <assert.h>
static int do_write(struct abstract_write **w, 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 buffer_node *new; struct buffer_node *new;
MDEBUG(closure); MDEBUG(closure);
......
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