]> code.citadel.org Git - citadel.git/commitdiff
* now memreadline creeps lower in the gprof radar.
authorWilfried Göesgens <willi@citadel.org>
Thu, 9 Aug 2007 23:55:07 +0000 (23:55 +0000)
committerWilfried Göesgens <willi@citadel.org>
Thu, 9 Aug 2007 23:55:07 +0000 (23:55 +0000)
citadel/tools.c

index 5a9a9839733ab01287f7d993db5f2034979c4ab5..7650baede5f2a19d1f8ada2bfd02a51db700ed9f 100644 (file)
@@ -478,7 +478,6 @@ int is_msg_in_sequence_set(char *mset, long msgnum) {
        return(0);
 }
 
-
 /** 
  * \brief Utility function to "readline" from memory
  * \param start Location in memory from which we are reading.
@@ -493,15 +492,14 @@ char *memreadline(char *start, char *buf, int maxlen)
        int len = 0;            /**< tally our own length to avoid strlen() delays */
 
        ptr = start;
-       memset(buf, 0, maxlen);
 
        while (1) {
                ch = *ptr++;
                if ((len + 1 < (maxlen)) && (ch != 13) && (ch != 10)) {
                        buf[len++] = ch;
-                       buf[len] = 0;
                }
                if ((ch == 10) || (ch == 0)) {
+                       buf[len] = 0;
                        return ptr;
                }
        }
@@ -509,6 +507,7 @@ char *memreadline(char *start, char *buf, int maxlen)
 
 
 
+
 /*
  * Strip a boundarized substring out of a string (for example, remove
  * parentheses and anything inside them).