more cosmetics.
[apps/madmutt.git] / lib-lib / str.h
index d62dc0a..e456fdd 100644 (file)
@@ -29,8 +29,8 @@
 #define STRING          256
 #define SHORT_STRING    128
 
-#define NONULL(x) (x?x:"")
-#define ISSPACE(c) isspace((unsigned char)c)
+#define NONULL(x)       (x?x:"")
+#define ISSPACE(c)      isspace((unsigned char)c)
 
 extern unsigned char const __m_strdigits[128];
 extern signed char const __m_b64digits[128];
@@ -100,7 +100,7 @@ static inline int m_strcasecmp(const char *a, const char *b) {
 }
 
 static inline int m_strncmp(const char *a, const char *b, ssize_t n) {
-    return strncmp (NONULL(a), NONULL(b), n);
+    return strncmp(NONULL(a), NONULL(b), n);
 }
 
 static inline int m_strncasecmp(const char *a, const char *b, ssize_t n) {
@@ -128,6 +128,14 @@ static inline char *m_strreplace(char **p, const char *s) {
     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);
 
@@ -181,12 +189,4 @@ m_stristr(const char *haystack, const char *needle) {
     return m_stristrn(haystack, needle, m_strlen(needle));
 }
 
-
-/****************************************************************************/
-/* misc functions                                                           */
-/****************************************************************************/
-
-/* replace any %s with src, or appends " $src" */
-ssize_t m_snsubst(char *dst, ssize_t n, const char *fmt, const char *src);
-
 #endif /* MUTT_LIB_LIB_STR_H */