diff options
author | David Herrmann <dh.herrmann@googlemail.com> | 2012-09-16 09:23:35 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@googlemail.com> | 2012-09-16 09:23:35 +0200 |
commit | 04e3bcc652d43887064e3a7b32b16c38b3f47dd5 (patch) | |
tree | 26c6f3f88f5f33e07b86d66cecd61b438a770d75 /src/pty.c | |
parent | f3e3973d56a1396c68521f779bb0058bd0338fde (diff) |
shl: move kmscon_ring_* to shl
The ring implementation is only used in one place so move it into SHL to
avoid linking it into all other libraries and applications.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Diffstat (limited to 'src/pty.c')
-rw-r--r-- | src/pty.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -38,8 +38,8 @@ #include "eloop.h" #include "log.h" #include "main.h" -#include "static_misc.h" #include "pty.h" +#include "shl_ring.h" #define LOG_SUBSYSTEM "pty" @@ -52,7 +52,7 @@ struct kmscon_pty { int fd; pid_t child; struct ev_fd *efd; - struct kmscon_ring *msgbuf; + struct shl_ring *msgbuf; char io_buf[KMSCON_NREAD]; kmscon_pty_input_cb input_cb; @@ -79,7 +79,7 @@ int kmscon_pty_new(struct kmscon_pty **out, struct ev_eloop *loop, pty->input_cb = input_cb; pty->data = data; - ret = kmscon_ring_new(&pty->msgbuf); + ret = shl_ring_new(&pty->msgbuf); if (ret) goto err_free; @@ -108,7 +108,7 @@ void kmscon_pty_unref(struct kmscon_pty *pty) log_debug("free pty object"); kmscon_pty_close(pty); - kmscon_ring_free(pty->msgbuf); + shl_ring_free(pty->msgbuf); ev_eloop_unref(pty->eloop); free(pty); } @@ -268,10 +268,10 @@ static int send_buf(struct kmscon_pty *pty) size_t len; int ret; - while ((buf = kmscon_ring_peek(pty->msgbuf, &len))) { + while ((buf = shl_ring_peek(pty->msgbuf, &len))) { ret = write(pty->fd, buf, len); if (ret > 0) { - kmscon_ring_drop(pty->msgbuf, ret); + shl_ring_drop(pty->msgbuf, ret); continue; } @@ -408,7 +408,7 @@ int kmscon_pty_write(struct kmscon_pty *pty, const char *u8, size_t len) if (!pty || !pty_is_open(pty) || !u8 || !len) return -EINVAL; - if (!kmscon_ring_is_empty(pty->msgbuf)) + if (!shl_ring_is_empty(pty->msgbuf)) goto buf; ret = write(pty->fd, u8, len); @@ -427,7 +427,7 @@ int kmscon_pty_write(struct kmscon_pty *pty, const char *u8, size_t len) ev_fd_update(pty->efd, EV_READABLE | EV_WRITEABLE); buf: - ret = kmscon_ring_write(pty->msgbuf, u8, len); + ret = shl_ring_write(pty->msgbuf, u8, len); if (ret) log_warn("cannot allocate buffer; dropping output"); |