* in multithreaded environment with a same SilcBuffer context without
* concurrency control.
*
+ * EXAMPLE
+ *
+ * SilcBufferStruct buffer;
+ *
+ * memset(&buffer, 0, sizeof(buffer));
+ * ret = silc_buffer_format(&buffer,
+ * SILC_STR_UI_INT(intval),
+ * SILC_STR_CHAR(charval),
+ * SILC_STR_UI_INT(intval),
+ * SILC_STR_SHORT(str_len),
+ * SILC_STR_DATA(str, str_len),
+ * SILC_STR_END);
+ * if (ret < 0)
+ * error;
+ *
***/
#ifndef SILCBUFFMT_H
*
* DESCRIPTION
*
- * Formats a buffer from a variable argument list. Returns -1 on error
- * and the length of the formatted buffer otherwise. The buffer is
- * enlarged automatically during formatting, if it doesn't already have
- * enough space.
+ * Formats a buffer from a variable argument list. Returns -1 if the
+ * system is out of memory and the length of the formatted buffer otherwise.
+ * The buffer is enlarged automatically during formatting, if it doesn't
+ * already have enough space.
*
* EXAMPLE
*
* DESCRIPTION
*
* Same as silc_buffer_format but uses `stack' to allocate the memory.
- * if `stack' is NULL reverts back to silc_buffer_format call.
+ * if `stack' is NULL reverts back to silc_buffer_format call. Returns
+ * -1 if system is out of memory.
*
* Note that this call consumes the `stack'. The caller should push the
* stack before calling the function and pop it later.
* DESCRIPTION
*
* Formats a buffer from a variable argument list indicated by the `ap'.
- * Returns -1 on error and the length of the formatted buffer otherwise.
+ * Returns -1 if system is out of memory and the length of the formatted
+ * buffer otherwise.
*
***/
int silc_buffer_format_vp(SilcBuffer dst, va_list ap);
* DESCRIPTION
*
* Same as silc_buffer_format_vp but uses `stack' to allocate the memory.
- * if `stack' is NULL reverts back to silc_buffer_format_vp call.
+ * if `stack' is NULL reverts back to silc_buffer_format_vp call. Returns
+ * -1 if system is out of memory.
*
* Note that this call consumes the `stack'. The caller should push the
* stack before calling the function and pop it later.
* be end with SILC_STRFMT_END argument. This allows that a string in
* the list can be NULL, in which case it is skipped. This automatically
* allocates the space for the buffer data but `dst' must be already
- * allocated by the caller.
+ * allocated by the caller. Returns -1 if system is out of memory.
*
* EXAMPLE
*
* the list can be NULL, in which case it is skipped. This automatically
* allocates the space for the buffer data but `dst' must be already
* allocated by the caller. This function is equivalent to
- * silc_buffer_strformat but allocates memory from `stack'.
+ * silc_buffer_strformat but allocates memory from `stack'. Returns -1
+ * if system is out of memory.
*
* Note that this call consumes the `stack'. The caller should push the
* stack before calling the function and pop it later.