summaryrefslogtreecommitdiff
path: root/libvirt-utils.h
diff options
context:
space:
mode:
authorPavel Hrdina <phrdina@redhat.com>2018-02-19 14:46:54 +0100
committerPavel Hrdina <phrdina@redhat.com>2018-02-19 15:55:28 +0100
commit920be923973cf3127aba204336873f8d386c3e87 (patch)
treecdb79aae3a85c7f51f015b256c35954881645123 /libvirt-utils.h
parent314b2346df2d8e2d7d705b003c693b4fa0189bdf (diff)
downloadlibvirt-python-920be923973cf3127aba204336873f8d386c3e87.tar.gz
Use static variables to store virPyDictToTypedParams hints
There is no need to have dynamic allocation every time the API is called. Rewrites commit <314b2346df>. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Diffstat (limited to 'libvirt-utils.h')
-rw-r--r--libvirt-utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/libvirt-utils.h b/libvirt-utils.h
index 779fd56..0af1e62 100644
--- a/libvirt-utils.h
+++ b/libvirt-utils.h
@@ -146,6 +146,8 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1);
# endif
+#define VIR_N_ELEMENTS(array) (sizeof(array) / sizeof(*(array)))
+
/* The two-statement sequence "Py_INCREF(Py_None); return Py_None;"
is so common that we encapsulate it here. Now, each use is simply
return VIR_PY_NONE; */