Re: [hackers] [st] Remove strsep() call || Roberto E. Vargas Caballero

From: Truls Becken <truls.becken_AT_gmail.com>
Date: Fri, 20 Mar 2015 10:05:08 +0100

Hi, I think the loop is simpler without the int c variable.

Cheers,
Truls
---
 st.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/st.c b/st.c
index 39d3fee..9f29130 100644
--- a/st.c
+++ b/st.c
_AT_@ -2272,20 +2272,16 @@ strhandle(void) {
 void
 strparse(void) {
-   int c;
    char *p = strescseq.buf;
    strescseq.narg = 0;
    strescseq.buf[strescseq.len] = '\0';
-   if(*p == '\0')
-       return;
-
-   while(strescseq.narg < STR_ARG_SIZ) {
+   while(*p && strescseq.narg < STR_ARG_SIZ) {
        strescseq.args[strescseq.narg++] = p;
-       while((c = *p) != ';' && c != '\0')
+       while(*p && *p != ';')
            ++p;
-       if(c == '\0')
+       if(!*p)
            return;
        *p++ = '\0';
    }
--
1.8.4
Received on Fri Mar 20 2015 - 10:05:08 CET

This archive was generated by hypermail 2.3.0 : Fri Mar 20 2015 - 10:12:09 CET