summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Novacek <rnovacek@redhat.com>2013-05-16 09:16:39 +0200
committerRadek Novacek <rnovacek@redhat.com>2013-05-16 10:37:25 +0200
commitdac1795235eef3868a35b5b571b8f6b0f0e140af (patch)
tree884214e02d8fb14f6230456569e4a34393867c28
parent6050f96d59b73653cb134c1d9df66a2d6a4935e8 (diff)
downloadopenlmi-providers-dac1795235eef3868a35b5b571b8f6b0f0e140af.tar.gz
openlmi-providers-dac1795235eef3868a35b5b571b8f6b0f0e140af.tar.xz
openlmi-providers-dac1795235eef3868a35b5b571b8f6b0f0e140af.zip
Add ReturnInstance macro to be used instead of KReturnInstance
KReturnInstance macro calls return directly on failure which is bad because there is no possibility to do cleanups or other error handling. ReturnInstance macro returns plain boolean to indicate if the instance is returned properly.
-rw-r--r--src/openlmi.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/openlmi.h b/src/openlmi.h
index 9b27d07..6ab4158 100644
--- a/src/openlmi.h
+++ b/src/openlmi.h
@@ -65,6 +65,16 @@ int lmi_log_level(void);
*/
void lmi_set_log_level(int level);
+/**
+ * Add an instance \p w to the result \p cr.
+ *
+ * @param cr CMPIResult where should be the instance added
+ * @param w instance to add
+ * @retval true if succeeds
+ * @retval false if addition fails
+ */
+#define LMI_ReturnInstance(cr, w) KOkay(__KReturnInstance((cr), &(w).__base))
+
enum {
_LMI_DEBUG_NONE=0, _LMI_DEBUG_ERROR, _LMI_DEBUG_WARN,
_LMI_DEBUG_INFO, _LMI_DEBUG_DEBUG