You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ji...@apache.org on 2002/09/06 22:27:06 UTC
cvs commit: apr/include apr_strings.h
jim 2002/09/06 13:27:06
Modified: include apr_strings.h
Log:
Update the inline comments to reflect reality regarding how apr_snprintf
works. Document the "new" special case.
Revision Changes Path
1.31 +7 -5 apr/include/apr_strings.h
Index: apr_strings.h
===================================================================
RCS file: /home/cvs/apr/include/apr_strings.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- apr_strings.h 3 Aug 2002 19:31:36 -0000 1.30
+++ apr_strings.h 6 Sep 2002 20:27:06 -0000 1.31
@@ -265,16 +265,18 @@
*
* Note that various standards and implementations disagree on the return
* value of snprintf, and side-effects due to %n in the formatting string.
- * apr_snprintf behaves as follows:
+ * apr_snprintf (and apr_vsnprintf) behaves as follows:
*
* Process the format string until the entire string is exhausted, or
* the buffer fills. If the buffer fills then stop processing immediately
* (so no further %n arguments are processed), and return the buffer
- * length. In all cases the buffer is NUL terminated.
+ * length. In all cases the buffer is NUL terminated. It will return the
+ * number of characters inserted into the buffer, not including the
+ * terminating NUL. As a special case, if len is 0, apr_snprintf will
+ * return the number of characters that would have been inserted if
+ * the buffer had been infinite (in this case, *buffer can be NULL)
*
- * In no event does apr_snprintf return a negative number. It's not possible
- * to distinguish between an output which was truncated, and an output which
- * exactly filled the buffer.
+ * In no event does apr_snprintf return a negative number.
* @{
*/