summaryrefslogtreecommitdiff
path: root/libvirt-utils.c
Commit message (Collapse)AuthorAgeFilesLines
* Drop support for python 2Daniel P. Berrangé2019-12-041-16/+1
| | | | | | | | | python2 will be end of life by the time of the next libvirt release. All our supported build targets, including CentOS7, have a python3 build available. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* libvirt_charPtrUnwrap: remove unnecessary check of returned stringPavel Hrdina2018-06-121-7/+3
| | | | | | | | Function libvirt_charPtrUnwrap() either fails or always sets the unwrapped string so there is no need to check it explicitly. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* libvirt-utils: remove unused py_str functionPavel Hrdina2018-06-121-14/+0
| | | | | | | | Commit <57a160b5248ba47d4e1c9d22d95847dad8e0524f> removed last usage but did not remove the function itself. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Avoid implicit treatment of an arithmetic result as a booleanDaniel P. Berrange2017-09-261-1/+1
| | | | | | | | | | | | | | | Latest GCC versions are unhappy with us treating an integer arithmetic result as a boolean: libvirt-utils.c: In function ‘virReallocN’: libvirt-utils.c:111:23: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context] if (!tmp && (size * count)) { ~~~~~~^~~~~~~~ Add an explicit comparison '!= 0' to keep it happy, since its suggestion to use '&&' is nonsense. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix comparisons between signed & unsigned integersDaniel P. Berrange2017-09-261-4/+4
| | | | | | | | | When python3 builds C modules, it adds the -Wsign-compare flag to GCC. This creates lots of warnings where we compare a 'size_t' value against an 'int' value due to signed/unsigned difference. Change all the size_t types to ssize_t to address this. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* don't overrun buffer when converting cpumapv2.5.0Konstantin Neumoin2016-11-111-6/+1
| | | | | | | | | | | If we pass large(more than cpunum) cpu mask to any libvirt_virDomainPin* function, it could leads to crash. So we have to check tuple size in virPyCpumapConvert and ignore extra tuple members. Since we allocate a zeroed buffer, we don't need to bother with setting the bits to zero. Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
* move cpumap conversion code to a common helperKonstantin Neumoin2016-11-111-0/+57
| | | | | | | | All libvirt_virDomainPin* functions do the same thing for convert pycpumap to cpumap, so this patch moves all common logic to new helper - virPyCpumapConvert. Signed-off-by: Konstantin Neumoin <kneumoin@virtuozzo.com>
* use VIR_PY_DICT_SET_GOTOPavel Hrdina2015-10-051-11/+2
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* indent labels by one spacePavel Hrdina2015-10-051-2/+2
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* cleanup functions definitionPavel Hrdina2015-10-051-10/+15
| | | | | | Follow the libvirt hacking guide and make the code consistent. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Move utils and shared code into libvirt-utilsPavel Hrdina2015-10-051-0/+406
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Import some virTypedParams* APIs from libvirtDoug Goldstein2013-11-221-0/+46
| | | | | | | virTypedParamsClear() and virTypedParamsFree() were introduced in libvirt 1.0.2. In an effort to keep the code clean bring these two functions to libvirt-python if we're building against a version of libvirt that's older than 1.0.2
* Import VIR_FORCE_CLOSE macro from libvirtDaniel P. Berrange2013-11-221-0/+20
| | | | | | Import the macro for safely closing file descriptors Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Import VIR_ALLOC / VIR_ALLOC_N / VIR_REALLOC_N functionsDaniel P. Berrange2013-11-221-0/+120
Import the libvirt memory allocation functions, stripping the OOM testing and error reporting pieces. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>