ABI compatibility question: static strings returned from some functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have some functions such as virConnectGetType which are defined to return statically allocated strings:

/**
 * virConnectGetType:
 * @conn: pointer to the hypervisor connection
 *
 * Get the name of the Hypervisor software used.
 *
* Returns NULL in case of error, a static zero terminated string otherwise.
 */
const char *
virConnectGetType(virConnectPtr conn)
[...]

This is all well and good in the typical local case, but when working over a remote connection the string we return is allocated and requires freeing at some point. Unfortunately I don't see a good thing to do in this case except to change the semantics of virConnectGetType, which arguably breaks ABI compatibility.

Suggestions from anyone?

Rich.

garbage.collection++

--
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421
 "[Negative numbers] darken the very whole doctrines of the equations
 and make dark of the things which are in their nature excessively
 obvious and simple" (Francis Maseres FRS, mathematician, 1759)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]