From 2c1209ba63b377c83c9478e41557a904c2d50b83 Mon Sep 17 00:00:00 2001 From: "Sunrim KIM (keen)" <3han5chou7@gmail.com> Date: Fri, 18 Jul 2014 15:44:29 +0900 Subject: [PATCH] remove redundant brace following review --- src/read.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/read.c b/src/read.c index 7b059a30..142db83c 100644 --- a/src/read.c +++ b/src/read.c @@ -361,6 +361,8 @@ read_pipe(pic_state *pic, struct pic_port *port, char c) char *buf; size_t size, cnt; pic_sym sym; + /* Currently supports only ascii chars */ + char HEX_BUF[3]; size = 256; buf = pic_alloc(pic, size); @@ -373,16 +375,11 @@ read_pipe(pic_state *pic, struct pic_port *port, char c) case 't': c = '\t'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; - case 'x':{ - /* Currently supports only ascii chars */ - size_t s = 3; /* 2 bytes of hex + 1 byte of terminator(';')*/ - char hex[s]; - size_t i = 0; - while((hex[i++] = (next(port))) != ';' && i < s); - c = (char)strtol(hex, NULL, 16); + case 'x': + for(size_t i = 0; (HEX_BUF[i++] = (next(port))) != ';' && i < sizeof HEX_BUF;); + c = (char)strtol(HEX_BUF, NULL, 16); break; } - } } buf[cnt++] = c; if (cnt >= size) {