Small code's simplifying: use issoftcr() in span*() functions

This commit is contained in:
Stas Degteff 2008-01-20 12:55:24 +00:00
parent 1632703681
commit 595346f1ac

View File

@ -498,31 +498,24 @@ void edit_addressbook(GMsg* msg);
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// SOFTCR management // SOFTCR management
// Detects SoftCR only if DispsoftCR is ON
inline bool issoftcr(char c) inline bool issoftcr(char c)
{ {
return not WideDispsoftcr and (c == SOFTCR); return not WideDispsoftcr and (c == SOFTCR);
} }
// Skip spaces and SoftCRs (if DispsoftCR is ON)
inline char *spanspaces(const char *str) inline char *spanspaces(const char *str)
{ {
if (WideDispsoftcr) while ( (isspace(*str) and (*str != CR)) or issoftcr(*str) )
while(isspace(*str) and (*str != CR))
str++;
else
while((isspace(*str) and (*str != CR)) or (*str == SOFTCR))
str++; str++;
return (char *)str; return (char *)str;
} }
// Skip LineFeeds and SoftCRs (if DispsoftCR is ON)
inline char *spanfeeds(const char *str) inline char *spanfeeds(const char *str)
{ {
if (WideDispsoftcr) while ( (*str == LF) or issoftcr(*str) )
while(*str == LF)
str++;
else
while((*str == LF) or (*str == SOFTCR))
str++; str++;
return (char *)str; return (char *)str;
} }