On 10/17/2011 05:20 AM, Hai Dong Li wrote:
On 09/30/2011 12:22 AM, Eric Blake wrote:
Although the compiler wasn't complaining (since it was the pointer,
rather than what was being pointed to, that was actually const), it
looks quite suspicious to call a function with an argument labeled
const when the nature of the pointer (virBufferPtr) is hidden behind
a typedef. Dropping const makes the function declarations easier
to read.
+++ b/src/util/buf.c
@@ -39,7 +39,7 @@ struct _virBuffer {
* freeing the content and setting the error flag.
*/
static void
-virBufferSetError(const virBufferPtr buf)
+virBufferSetError(virBufferPtr buf)
{
VIR_FREE(buf->content);
buf->size = 0;
@@ -113,7 +113,7 @@ virBufferAdd(const virBufferPtr buf, const char
*str, int len)
Maybe a typo here?The virBufferPtr still remains const, but the
declaration of this function in the buf.h shows this const is removed, too.
No. Rather, this is an artifact of git diff. When showing the context
line for a hunk, it uses the context from the pre-patch file (where the
'const' was still present), even though the hunk itself applies to the
post-patch version without 'const'. Basically, I never worry about the
@@ lines - they are there as hints for where to apply the patch, and not
a definitive part of the patch itself.
--
Eric Blake ebl...@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list