#include <stdarg.h>
#include "c-ctype.h"
-#define __VIR_BUFFER_C__
-
#include "virbuffer.h"
#include "virerror.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_NONE
-/* If adding more fields, ensure to edit buf.h to match
- the number of fields */
-struct _virBuffer {
- unsigned int size;
- unsigned int use;
- unsigned int error; /* errno value, or -1 for usage error */
- int indent;
- char *content;
-};
-
/**
* virBufferFail
* @buf: the buffer
typedef struct _virBuffer virBuffer;
typedef virBuffer *virBufferPtr;
-# ifndef __VIR_BUFFER_C__
-# define VIR_BUFFER_INITIALIZER { 0, 0, 0, 0, NULL }
+# define VIR_BUFFER_INITIALIZER { 0, 0, 0, 0, NULL }
-/* This struct must be kept in sync with the real struct
- in the buf.c impl file */
struct _virBuffer {
- unsigned int a;
- unsigned int b;
- unsigned int c;
- int d;
- char *e;
+ unsigned int size;
+ unsigned int use;
+ unsigned int error; /* errno value, or -1 for usage error */
+ int indent;
+ char *content;
};
-# endif
const char *virBufferCurrentContent(virBufferPtr buf);
char *virBufferContentAndReset(virBufferPtr buf);
* which was the case after the above addchar at the time of the bug.
* This test is a bit fragile, since it relies on virBuffer internals.
*/
- if (virAsprintf(&addstr, "%*s", buf->a - buf->b - 1, "a") < 0)
+ if (virAsprintf(&addstr, "%*s", buf->size - buf->use - 1, "a") < 0)
goto out;
if (info->doEscape)