changeset 401:3f20ac9a9e1d

Using th_isspace() should be enough to detect \r and \n.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 May 2012 05:02:27 +0300
parents ec974049ccba
children 563a70e8a303
files nnchat.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Thu May 24 05:01:46 2012 +0300
+++ b/nnchat.c	Thu May 24 05:02:27 2012 +0300
@@ -911,7 +911,7 @@
     /* Trim right */
     bufLen--;
     buf[bufLen--] = 0;
-    while (bufLen > 0 && (buf[bufLen] == '\n' || buf[bufLen] == '\r' || th_isspace(buf[bufLen])))
+    while (bufLen > 0 && th_isspace(buf[bufLen]))
         buf[bufLen--] = 0;
 
     /* Decode completed usernames */
@@ -1391,7 +1391,7 @@
     if (curVis != ERR)
         curs_set(curVis);
 
-    for (pos = strlen(tmpBuf) - 1; pos > 0 && (tmpBuf[pos] == '\n' || tmpBuf[pos] == '\r' || th_isspace(tmpBuf[pos])); pos--)
+    for (pos = strlen(tmpBuf) - 1; pos > 0 && th_isspace(tmpBuf[pos]); pos--)
         tmpBuf[pos] = 0;
 
     ptr = str_trim_left(tmpBuf);