src/str.c
changeset 128 6c5a5fdfd1d5
parent 125 5c70fb2d6793
child 129 361740b82fe5
--- a/src/str.c	Sat Apr 11 04:26:46 2009 +0300
+++ b/src/str.c	Sat Apr 11 04:41:44 2009 +0300
@@ -6,12 +6,7 @@
 #include <string.h>
 #include <assert.h>
 
-/**
- * Writes the given string into the given buffer, writing at most buf_size bytes, including the terminating NUL.
- *
- * Returns the number of input bytes that would have been written, not including the terminating NUL.
- */
-static size_t str_append (char *buf, size_t buf_size, const char *str)
+size_t str_append (char *buf, size_t buf_size, const char *str)
 {
     size_t str_len;
     
@@ -31,12 +26,7 @@
     return str_len;
 }
 
-/**
- * Like str_append, but only a single char.
- *
- * @see str_append()
- */
-static size_t str_append_char (char *buf, size_t buf_size, char c)
+size_t str_append_char (char *buf, size_t buf_size, char c)
 {
     if (buf_size > 1)
         *buf++ = c;
@@ -47,12 +37,7 @@
     return 1;
 }
 
-/**
- * Like str_append, but using formatted input instead.
- *
- * @see str_append()
- */
-static size_t str_append_fmt (char *buf, size_t buf_size, const char *fmt, ...)
+size_t str_append_fmt (char *buf, size_t buf_size, const char *fmt, ...)
 {
     va_list vargs;
     int ret;
@@ -86,10 +71,7 @@
     { 0,    NULL    }
 };
 
-/**
- * Use str_append* to write out the quoted char value to the given buffer.
- */
-static size_t str_quote_char (char *buf, size_t buf_size, char c)
+size_t str_quote_char (char *buf, size_t buf_size, char c)
 {
     const struct str_quote_item *quote_item = _quote_table;
 
@@ -121,6 +103,9 @@
     return len;
 }
 
+/**
+ * Number of bytes reserved by str_quote for the trailing overflow stuff
+ */
 #define STR_QUOTE_RESERVED 5
 
 size_t str_quote (char *buf, size_t buf_size, const char *str, ssize_t str_len)