2007-03-15 17:30:04 +00:00
|
|
|
/*
|
2007-06-26 22:21:22 +00:00
|
|
|
* buf.h: buffers for libvirt
|
2007-03-15 17:30:04 +00:00
|
|
|
*
|
Eliminate all uses of virBufferAdd with string literals.
* Makefile.maint (sc_prohibit_virBufferAdd_with_string_literal):
New rule.
* src/buf.h (virBufferAddLit): Define.
* src/conf.c (virConfSaveValue): Use virBufferAddLit, in place
of virBufferAdd everywhere possible.
(virConfSaveEntry): Likewise.
* src/qemu_conf.c (qemudGenerateXML, qemudGenerateNetworkXML): Likewise.
* src/qemu_driver.c (qemudGetFeatures, qemudGetCapabilities): Likewise.
* src/test.c (testDomainDumpXML, testNetworkDumpXML): Likewise.
* src/xen_internal.c (xenHypervisorMakeCapabilitiesXML): Likewise.
* src/xend_internal.c (xend_parse_sexp_desc_os): Likewise.
(xend_parse_sexp_desc, sexpr_to_xend_topology_xml): Likewise.
* src/xm_internal.c (xenXMDomainFormatXML, xenXMDomainPinVcpu): Likewise.
* src/xml.c (virSaveCpuSet, virParseXenCpuTopology): Likewise.
(virDomainParseXMLGraphicsDescImage): Likewise.
(virDomainParseXMLGraphicsDescVFB, virDomainParseXMLOSDescHVM): Likewise.
(virDomainParseXMLOSDescPV, virDomainParseXMLDiskDesc): Likewise.
(virDomainParseXMLIfDesc, virDomainParseXMLDesc): Likewise.
2008-02-05 14:22:28 +00:00
|
|
|
* Copyright (C) 2005-2008 Red Hat, Inc.
|
2007-03-15 17:30:04 +00:00
|
|
|
*
|
|
|
|
* See COPYING.LIB for the License of this software
|
|
|
|
*
|
|
|
|
* Daniel Veillard <veillard@redhat.com>
|
|
|
|
*/
|
|
|
|
|
2007-06-26 22:21:22 +00:00
|
|
|
#ifndef __VIR_BUFFER_H__
|
|
|
|
#define __VIR_BUFFER_H__
|
2007-03-15 17:30:04 +00:00
|
|
|
|
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
/**
|
2007-06-26 22:21:22 +00:00
|
|
|
* virBuffer:
|
2007-03-15 17:30:04 +00:00
|
|
|
*
|
|
|
|
* A buffer structure.
|
|
|
|
*/
|
2007-06-26 22:21:22 +00:00
|
|
|
typedef struct _virBuffer virBuffer;
|
|
|
|
typedef virBuffer *virBufferPtr;
|
|
|
|
struct _virBuffer {
|
2007-03-15 17:30:04 +00:00
|
|
|
char *content; /* The buffer content UTF8 */
|
|
|
|
unsigned int use; /* The buffer size used */
|
|
|
|
unsigned int size; /* The buffer size */
|
|
|
|
};
|
|
|
|
|
2007-06-26 22:21:22 +00:00
|
|
|
virBufferPtr virBufferNew(unsigned int size);
|
|
|
|
void virBufferFree(virBufferPtr buf);
|
|
|
|
char *virBufferContentAndFree(virBufferPtr buf);
|
|
|
|
int virBufferAdd(virBufferPtr buf, const char *str, int len);
|
2007-12-17 10:05:35 +00:00
|
|
|
int virBufferAddChar(virBufferPtr buf, char c);
|
2007-06-26 22:21:22 +00:00
|
|
|
int virBufferVSprintf(virBufferPtr buf, const char *format, ...)
|
2007-03-15 17:30:04 +00:00
|
|
|
ATTRIBUTE_FORMAT(printf, 2, 3);
|
2007-06-26 22:21:22 +00:00
|
|
|
int virBufferStrcat(virBufferPtr buf, ...);
|
2007-07-09 11:24:52 +00:00
|
|
|
int virBufferEscapeString(virBufferPtr buf, const char *format, const char *str);
|
2007-12-17 10:05:35 +00:00
|
|
|
int virBufferURIEncodeString (virBufferPtr buf, const char *str);
|
2007-03-15 17:30:04 +00:00
|
|
|
|
Eliminate all uses of virBufferAdd with string literals.
* Makefile.maint (sc_prohibit_virBufferAdd_with_string_literal):
New rule.
* src/buf.h (virBufferAddLit): Define.
* src/conf.c (virConfSaveValue): Use virBufferAddLit, in place
of virBufferAdd everywhere possible.
(virConfSaveEntry): Likewise.
* src/qemu_conf.c (qemudGenerateXML, qemudGenerateNetworkXML): Likewise.
* src/qemu_driver.c (qemudGetFeatures, qemudGetCapabilities): Likewise.
* src/test.c (testDomainDumpXML, testNetworkDumpXML): Likewise.
* src/xen_internal.c (xenHypervisorMakeCapabilitiesXML): Likewise.
* src/xend_internal.c (xend_parse_sexp_desc_os): Likewise.
(xend_parse_sexp_desc, sexpr_to_xend_topology_xml): Likewise.
* src/xm_internal.c (xenXMDomainFormatXML, xenXMDomainPinVcpu): Likewise.
* src/xml.c (virSaveCpuSet, virParseXenCpuTopology): Likewise.
(virDomainParseXMLGraphicsDescImage): Likewise.
(virDomainParseXMLGraphicsDescVFB, virDomainParseXMLOSDescHVM): Likewise.
(virDomainParseXMLOSDescPV, virDomainParseXMLDiskDesc): Likewise.
(virDomainParseXMLIfDesc, virDomainParseXMLDesc): Likewise.
2008-02-05 14:22:28 +00:00
|
|
|
#define virBufferAddLit(buf_, literal_string_) \
|
|
|
|
virBufferAdd (buf_, "" literal_string_ "", sizeof literal_string_ - 1)
|
|
|
|
|
2007-06-26 22:21:22 +00:00
|
|
|
#endif /* __VIR_BUFFER_H__ */
|