[hackers] [scc] [cc2-qbe] fix eval call with NULL in oreturn || Quentin Rameau

From: <git_AT_suckless.org>
Date: Tue, 12 Jul 2016 18:58:41 +0200 (CEST)

commit b3b6ae58bc48acb7f2712cdb1c64116ff2335d9f
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Tue Jul 12 18:45:33 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Tue Jul 12 18:56:57 2016 +0200

    [cc2-qbe] fix eval call with NULL in oreturn
    
    Actually pass the resulting token to eval instead of trying to parse
    it again an having a null pointer.

diff --git a/cc2/parser.c b/cc2/parser.c
index 5a6d3f7..bf3fa25 100644
--- a/cc2/parser.c
+++ b/cc2/parser.c
_AT_@ -329,9 +329,8 @@ oreturn(char *token, union tokenop u)
 {
         Node *np = newnode(u.op);
 
- token = strtok(NULL, "\t\n");
- if (token)
- eval(strtok(NULL, "\t\n"));
+ if (token = strtok(NULL, "\t\n"))
+ eval(token);
         if (!empty())
                 np->left = pop();
         push(np);
Received on Tue Jul 12 2016 - 18:58:41 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 12 2016 - 19:00:25 CEST