diff th_string.h @ 186:1ee46a95aa8c

Clean up the code, add argument identifiers to function prototypes and sanitize some of them.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 10 Feb 2016 16:34:44 +0200
parents 7638fa9d191f
children 099a1a156fd7
line wrap: on
line diff
--- a/th_string.h	Tue Mar 31 11:26:26 2015 +0300
+++ b/th_string.h	Wed Feb 10 16:34:44 2016 +0200
@@ -50,23 +50,24 @@
 
 /* Normal NUL-terminated string functions
  */
-char    *th_strdup(const char *);
-char    *th_strndup(const char *, const size_t);
-char    *th_strdup_trim(const char *, const int);
+char    *th_strdup(const char *src);
+char    *th_strndup(const char *src, const size_t n);
+char    *th_strdup_trim(const char *, const int flags);
 
-int     th_strcasecmp(const char *, const char *);
-int     th_strncasecmp(const char *, const char *, size_t);
-char    *th_strrcasecmp(char *str, const char *needle);
-void    th_strip_ctrlchars(char *);
+int     th_strcasecmp(const char *haystack, const char *needle);
+int     th_strncasecmp(const char *haystack, const char *needle, size_t n);
+char    *th_strrcasecmp(char *haystack, const char *needle);
+void    th_strip_ctrlchars(char *str);
 
-char    *th_strdup_vprintf(const char *, va_list);
-char    *th_strdup_printf(const char *, ...);
+char    *th_strdup_vprintf(const char *fmt, va_list ap);
+char    *th_strdup_printf(const char *fmt, ...);
 
-void    th_pstr_vprintf(char **, const char *, va_list);
-void    th_pstr_printf(char **, const char *, ...);
+void    th_pstr_vprintf(char **buf, const char *fmt, va_list ap);
+void    th_pstr_printf(char **buf, const char *fmt, ...);
 
-int     th_pstrcpy(char **, const char *);
-int     th_pstrcat(char **, const char *);
+int     th_pstrcpy(char **pdst, const char *src);
+int     th_pstrcat(char **pdst, const char *src);
+
 
 /* Parsing, matching
  */
@@ -74,10 +75,10 @@
 const char    *th_findsep(const char *, size_t *, char);
 const char    *th_findseporspace(const char *, size_t *, char);
 
-BOOL    th_strmatch(const char *, const char *);
-BOOL    th_strcasematch(const char *, const char *);
+BOOL    th_strmatch(const char *haystack, const char *pattern);
+BOOL    th_strcasematch(const char *haystack, const char *pattern);
 
-int     th_get_hex_triplet(const char *);
+int     th_get_hex_triplet(const char *str);
 BOOL    th_get_boolean(const char *str, BOOL *value);
 
 void    th_print_wrap(FILE *fh, const char *str, int spad, int rpad, int width);