[Libvir] begin conversion to safer use of sizeof: exposes a harmless bug
Daniel P. Berrange
berrange at redhat.com
Tue Dec 11 19:29:57 UTC 2007
On Tue, Dec 11, 2007 at 07:57:51PM +0100, Jim Meyering wrote:
> Subject: [PATCH] Use a variable name as sizeof argument, not a type name.
>
> Given code like: T *var = calloc (n, sizeof (T));
> Convert to this: T *var = calloc (n, sizeof (*var));
> This first-cut change adjusts all malloc, calloc, and
> realloc statements.
>
> The only binary differences are in remote_internal.c
> (due to the bug fix) and in xmlrpc.c (due to factorization).
>
> * python/libvir.c: As above.
> * qemud/event.c: Likewise.
> * qemud/mdns.c: Likewise.
> * qemud/qemud.c: Likewise.
> * qemud/remote.c: Likewise.
> * src/bridge.c: Likewise.
> * src/buf.c: Likewise.
> * src/conf.c: Likewise.
> * src/hash.c: Likewise.
> * src/iptables.c: Likewise.
> * src/openvz_conf.c: Likewise.
> * src/qemu_conf.c: Likewise.
> * src/qemu_driver.c: Likewise.
> * src/test.c: Likewise.
> * src/xen_internal.c: Likewise.
> * src/xen_unified.c: Likewise.
> * src/xm_internal.c: Likewise.
> * src/xml.c: Likewise.
> * tests/qemuxml2argvtest.c: Likewise.
> * src/xmlrpc.c (xmlRpcValuePtr): Likewise, and minor factorization.
> * src/remote_internal.c (remoteAuthMakeCredentials): Use the right
> type when allocating space for an array of cred _pointers_.
ACK.
Should we add a 'HACKING' file which mentions this coding standard and any of
the others we generally have for the benefit of anyone submitting patches
in the future
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
More information about the libvir-list
mailing list