From ca39c52dbd76f6d32a18d1d862ba0687a2b3e74e Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Mon, 26 Mar 2018 20:15:45 -0400 Subject: [PATCH] fixed a bad allocation and some minor static analysis issues --- lib/buf.c | 1 - lib/job.c | 2 +- lib/x11.c | 5 ++--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/buf.c b/lib/buf.c index 9841950..367943e 100644 --- a/lib/buf.c +++ b/lib/buf.c @@ -512,7 +512,6 @@ static void buf_resize(Buf* buf, size_t sz) { } static void delete(Buf* buf, size_t off) { - Rune rune = buf_get(buf, off); syncgap(buf, off); buf->gapend++; } diff --git a/lib/job.c b/lib/job.c index c094dd8..88cdc13 100644 --- a/lib/job.c +++ b/lib/job.c @@ -41,7 +41,7 @@ bool job_poll(int ms) { } void job_spawn(int fd, jobfn_t readfn, jobfn_t writefn, void* data) { - Job *job = calloc(1, sizeof(job)); + Job *job = calloc(1, sizeof(Job)); job->fd = fd; job->readfn = readfn; job->writefn = writefn; diff --git a/lib/x11.c b/lib/x11.c index 877bb20..80d2e57 100644 --- a/lib/x11.c +++ b/lib/x11.c @@ -722,15 +722,14 @@ static uint32_t special_keys(uint32_t key) { } static uint32_t getkey(XEvent* e) { - size_t i = 0, len = 0; char buf[8]; KeySym key; Status status; /* Read the key string */ if (X.xic) - len = Xutf8LookupString(X.xic, &(e->xkey), buf, sizeof(buf), &key, &status); + Xutf8LookupString(X.xic, &(e->xkey), buf, sizeof(buf), &key, &status); else - len = XLookupString(&(e->xkey), buf, sizeof(buf), &key, 0); + XLookupString(&(e->xkey), buf, sizeof(buf), &key, 0); /* if it's ascii, just return it */ if (key >= 0x20 && key <= 0x7F) return (uint32_t)key; -- 2.49.0