ovsdb: Fix double free in ovsdb_file_open_log().
[openvswitch] / lib / util.h
index 29e212dc52cc9d1e6194f637d46f48635fd5c629..f3bf80c6eaeddc760344b743bb30785d2258b985 100644 (file)
@@ -101,6 +101,14 @@ extern const char *program_name;
     ((OVS_TYPEOF(OBJECT)) (void *)                                      \
      ((char *) (POINTER) - ((char *) &(OBJECT)->MEMBER - (char *) (OBJECT))))
 
+/* Given POINTER, the address of the given MEMBER within an object of the type
+ * that that OBJECT points to, assigns the address of the outer object to
+ * OBJECT, which must be an lvalue.
+ *
+ * Evaluates to 1. */
+#define ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER) \
+    ((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), 1)
+
 #ifdef  __cplusplus
 extern "C" {
 #endif
@@ -129,6 +137,7 @@ void ovs_strlcpy(char *dst, const char *src, size_t size);
 void ovs_fatal(int err_no, const char *format, ...)
     PRINTF_FORMAT(2, 3) NO_RETURN;
 void ovs_error(int err_no, const char *format, ...) PRINTF_FORMAT(2, 3);
+const char *ovs_retval_to_string(int);
 void ovs_hex_dump(FILE *, const void *, size_t, uintptr_t offset, bool ascii);
 
 bool str_to_int(const char *, int base, int *);