* freeing the content and setting the error flag.
*/
static void
-virBufferSetError(const virBufferPtr buf)
+virBufferSetError(virBufferPtr buf)
{
VIR_FREE(buf->content);
buf->size = 0;
*
*/
void
-virBufferAdd(const virBufferPtr buf, const char *str, int len)
+virBufferAdd(virBufferPtr buf, const char *str, int len)
{
unsigned int needSize;
/**
* virBufferAddChar:
- * @buf: the buffer to add to
+ * @buf: the buffer to append to
* @c: the character to add
*
* Add a single character 'c' to a buffer.
* Returns the buffer content or NULL in case of error.
*/
char *
-virBufferContentAndReset(const virBufferPtr buf)
+virBufferContentAndReset(virBufferPtr buf)
{
char *str;
if (buf == NULL)
*
* Frees the buffer content and resets the buffer structure.
*/
-void virBufferFreeAndReset(const virBufferPtr buf)
+void virBufferFreeAndReset(virBufferPtr buf)
{
char *str = virBufferContentAndReset(buf);
/**
* virBufferAsprintf:
- * @buf: the buffer to dump
+ * @buf: the buffer to append to
* @format: the format
* @...: the variable list of arguments
*
* Do a formatted print to an XML buffer.
*/
void
-virBufferAsprintf(const virBufferPtr buf, const char *format, ...)
+virBufferAsprintf(virBufferPtr buf, const char *format, ...)
{
va_list argptr;
va_start(argptr, format);
* Do a formatted print to an XML buffer.
*/
void
-virBufferVasprintf(const virBufferPtr buf, const char *format, va_list argptr)
+virBufferVasprintf(virBufferPtr buf, const char *format, va_list argptr)
{
int size, count, grow_size;
va_list copy;
/**
* virBufferEscapeString:
- * @buf: the buffer to dump
+ * @buf: the buffer to append to
* @format: a printf like format string but with only one %s parameter
* @str: the string argument which need to be escaped
*
* is escaped to avoid generating a not well-formed XML instance.
*/
void
-virBufferEscapeString(const virBufferPtr buf, const char *format, const char *str)
+virBufferEscapeString(virBufferPtr buf, const char *format, const char *str)
{
int len;
char *escaped, *out;
/**
* virBufferEscapeSexpr:
- * @buf: the buffer to dump
+ * @buf: the buffer to append to
* @format: a printf like format string but with only one %s parameter
* @str: the string argument which need to be escaped
*
* doesn't fully escape the sexpr, just enough for our code to work.
*/
void
-virBufferEscapeSexpr(const virBufferPtr buf,
+virBufferEscapeSexpr(virBufferPtr buf,
const char *format,
const char *str)
{
/**
* virBufferEscape:
- * @buf: the buffer to dump
- * @toescape: NULL-terminated list of characters to escape
+ * @buf: the buffer to append to
+ * @toescape: NUL-terminated list of characters to escape
* @format: a printf like format string but with only one %s parameter
- * @str: the string argument which need to be escaped
+ * @str: the string argument which needs to be escaped
*
* Do a formatted print with a single string to a buffer. Any characters
* in the provided list are escaped with a preceeding \.
*/
void
-virBufferEscape(const virBufferPtr buf,
- const char *toescape,
- const char *format,
- const char *str)
+virBufferEscape(virBufferPtr buf, const char *toescape,
+ const char *format, const char *str)
{
int len;
char *escaped, *out;
/**
* virBufferURIEncodeString:
- * @buf: the buffer to append to
+ * @buf: the buffer to append to
* @str: the string argument which will be URI-encoded
*
* Append the string to the buffer. The string will be URI-encoded
* with '%xx' hex sequences).
*/
void
-virBufferURIEncodeString (virBufferPtr buf, const char *str)
+virBufferURIEncodeString(virBufferPtr buf, const char *str)
{
int grow_size = 0;
const char *p;
/**
* virBufferStrcat:
- * @buf: the buffer to dump
+ * @buf: the buffer to append to
* @...: the variable list of strings, the last argument must be NULL
*
* Concatenate strings to an XML buffer.
};
# endif
-char *virBufferContentAndReset(const virBufferPtr buf);
-void virBufferFreeAndReset(const virBufferPtr buf);
+char *virBufferContentAndReset(virBufferPtr buf);
+void virBufferFreeAndReset(virBufferPtr buf);
int virBufferError(const virBufferPtr buf);
unsigned int virBufferUse(const virBufferPtr buf);
-void virBufferAdd(const virBufferPtr buf, const char *str, int len);
-void virBufferAddChar(const virBufferPtr buf, char c);
-void virBufferAsprintf(const virBufferPtr buf, const char *format, ...)
+void virBufferAdd(virBufferPtr buf, const char *str, int len);
+void virBufferAddChar(virBufferPtr buf, char c);
+void virBufferAsprintf(virBufferPtr buf, const char *format, ...)
ATTRIBUTE_FMT_PRINTF(2, 3);
-void virBufferVasprintf(const virBufferPtr buf, const char *format, va_list ap)
+void virBufferVasprintf(virBufferPtr buf, const char *format, va_list ap)
ATTRIBUTE_FMT_PRINTF(2, 0);
-void virBufferStrcat(const virBufferPtr buf, ...)
+void virBufferStrcat(virBufferPtr buf, ...)
ATTRIBUTE_SENTINEL;
-void virBufferEscapeString(const virBufferPtr buf, const char *format, const char *str);
-void virBufferEscapeSexpr(const virBufferPtr buf, const char *format, const char *str);
-void virBufferEscape(const virBufferPtr buf, const char *toescape, const char *format, const char *str);
-void virBufferURIEncodeString (const virBufferPtr buf, const char *str);
+void virBufferEscape(virBufferPtr buf, const char *toescape,
+ const char *format, const char *str);
+void virBufferEscapeString(virBufferPtr buf, const char *format,
+ const char *str);
+void virBufferEscapeSexpr(virBufferPtr buf, const char *format,
+ const char *str);
void virBufferEscapeShell(virBufferPtr buf, const char *str);
+void virBufferURIEncodeString(virBufferPtr buf, const char *str);
# define virBufferAddLit(buf_, literal_string_) \
- virBufferAdd (buf_, "" literal_string_ "", sizeof literal_string_ - 1)
+ virBufferAdd(buf_, "" literal_string_ "", sizeof literal_string_ - 1)
#endif /* __VIR_BUFFER_H__ */