kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit baac693f2f90860a4697d7f8aec10f7dabc160d0
parent 423d57b08d9593587b797c5caae5304473415180
Author: Joris Vink <joris@coders.se>
Date:   Fri,  4 Jul 2014 11:25:05 +0200

Change type for data to void *

Diffstat:
includes/kore.h | 2+-
src/net.c | 12+++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/includes/kore.h b/includes/kore.h @@ -448,7 +448,7 @@ void net_recv_queue(struct connection *, size_t, int, struct netbuf **, int (*cb)(struct netbuf *)); int net_recv_expand(struct connection *c, struct netbuf *, size_t, int (*cb)(struct netbuf *)); -void net_send_queue(struct connection *, u_int8_t *, +void net_send_queue(struct connection *, void *, u_int32_t, struct spdy_stream *); void kore_buf_free(struct kore_buf *); diff --git a/src/net.c b/src/net.c @@ -27,25 +27,27 @@ net_init(void) } void -net_send_queue(struct connection *c, u_int8_t *data, u_int32_t len, +net_send_queue(struct connection *c, void *data, u_int32_t len, struct spdy_stream *s) { + u_int8_t *d; struct netbuf *nb; u_int32_t avail; + d = data; nb = TAILQ_LAST(&(c->send_queue), netbuf_head); if (nb != NULL && nb->b_len < nb->m_len && nb->stream == s) { avail = nb->m_len - nb->b_len; if (len < avail) { - memcpy(nb->buf + nb->b_len, data, len); + memcpy(nb->buf + nb->b_len, d, len); nb->b_len += len; return; } else if (len > avail) { - memcpy(nb->buf + nb->b_len, data, avail); + memcpy(nb->buf + nb->b_len, d, avail); nb->b_len += avail; len -= avail; - data += avail; + d += avail; if (len == 0) return; } @@ -67,7 +69,7 @@ net_send_queue(struct connection *c, u_int8_t *data, u_int32_t len, nb->buf = kore_malloc(nb->m_len); if (len > 0) - memcpy(nb->buf, data, nb->b_len); + memcpy(nb->buf, d, nb->b_len); TAILQ_INSERT_TAIL(&(c->send_queue), nb, list); }