tA simple strlen optimisation. - rohrpost - A commandline mail client to change the world as we see it.
 (HTM) git clone git://r-36.net/rohrpost
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 2416ddc611055cea5e0d7d56515a10cbadae1feb
 (DIR) parent 0ac6460464c949ccc9aa711651ceaa4b9512f120
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Thu, 27 Dec 2012 21:27:36 +0100
       
       A simple strlen optimisation.
       
       Diffstat:
         mime.c                              |       7 ++++---
       
       1 file changed, 4 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/mime.c b/mime.c
       t@@ -821,7 +821,7 @@ mime_preparepart(mime_t *mime)
        mime_t *
        mime_parsebufintern(mime_t *mime, char *str, int len)
        {
       -        int i, partlen, isend;
       +        int i, partlen, isend, blen;
                char *p, *rp, buf[1025], *key, *value, *tvalue, *part;
                llistelem_t *hdr;
                mime_t *partm;
       t@@ -829,8 +829,9 @@ mime_parsebufintern(mime_t *mime, char *str, int len)
                rp = str;
                p = str;
                for (rp = str, p = str; (rp = sgets(buf, sizeof(buf)-1, &p));) {
       -                if (buf[strlen(buf)-1] == '\r')
       -                        buf[strlen(buf)-1] = '\0';
       +                blen = strlen(buf);
       +                if (buf[blen-1] == '\r')
       +                        buf[blen-1] = '\0';
        
                        switch (mime->state) {
                        case HEADERVALUE: