return (*p = m_strdup(s));
}
+static inline ssize_t m_strputc(char *dst, ssize_t n, int c) {
+ if (n > 1) {
+ dst[0] = c;
+ dst[1] = '\0';
+ }
+ return 1;
+}
+
ssize_t m_strcpy(char *dst, ssize_t n, const char *src);
ssize_t m_strncpy(char *dst, ssize_t n, const char *src, ssize_t l);
}
if (addr->personal) {
- pos += m_strcpy(buf + pos, buflen - pos, ">");
+ pos += m_strputc(buf + pos, buflen - pos, '>');
}
if (addr->group) {
- pos += m_strcpy(buf + pos, buflen - pos, ":");
+ pos += m_strputc(buf + pos, buflen - pos, ':');
}
} else {
- pos += m_strcpy(buf + pos, buflen - pos, ";");
+ pos += m_strputc(buf + pos, buflen - pos, ';');
}
return pos;
return NULL;
}
-static /* const */ char *find_matching_paren ( /* const */ char *s)
+static const char *find_matching_paren (const char *s)
{
- int level = 1;
-
- for (; *s; s++) {
- if (*s == '(')
- level++;
- else if (*s == ')') {
- level--;
- if (!level)
- break;
+ int level = 1;
+
+ for (; *s; s++) {
+ level += (*s == '(') - (*s == ')');
+ if (!level)
+ break;
}
- }
- return s;
+ return s;
}
pattern_t *mutt_pattern_comp(const char *s, int flags, BUFFER *err)