]> git.mdlowis.com Git - projs/tide.git/commitdiff
fixed a bad allocation and some minor static analysis issues
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 27 Mar 2018 00:15:45 +0000 (20:15 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 27 Mar 2018 00:15:45 +0000 (20:15 -0400)
lib/buf.c
lib/job.c
lib/x11.c

index 9841950149e61747af673d0708292f0e48509ff5..367943e63b870ee2d4b82a9e1b14197e3e8b5d77 100644 (file)
--- 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++;
 }
index c094dd8e7087e7d706b01ece3cbbc7eb4176533f..88cdc13403bec85c0f5ef72bd3b18d03ad21932b 100644 (file)
--- 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;
index 877bb20adc2b330fcf323a3b49aa541e78a1b190..80d2e572c06ca6dd63542a71e5b49ac0ca3afd62 100644 (file)
--- 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;