[ovs-dev] [PATCH 01/15] table: Allow default style to be used in an assignment.

Jakub Sitnicki jkbs at redhat.com
Wed Jul 11 19:27:03 UTC 2018


Type cast lets us use the macro as the RHS expression in assignments
(structure copy), apart from the usual case of initialization.

Signed-off-by: Jakub Sitnicki <jkbs at redhat.com>
---
 lib/table.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/table.h b/lib/table.h
index 313ac1dd2..220a9818e 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -82,7 +82,8 @@ struct table_style {
     int max_column_width;       /* CF_STRING: Limit for column width. */
 };
 
-#define TABLE_STYLE_DEFAULT { TF_LIST, CF_STRING, true, JSSF_SORT, 0 }
+#define TABLE_STYLE_DEFAULT                     \
+    (struct table_style) { TF_LIST, CF_STRING, true, JSSF_SORT, 0 }
 
 #define TABLE_OPTION_ENUMS                      \
     OPT_NO_HEADINGS,                            \
-- 
2.14.4



More information about the dev mailing list