Separate enum from struct
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 30 Sep 2016 16:00:00 +0000 (12:00 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 30 Sep 2016 19:11:47 +0000 (15:11 -0400)
Otherwise the enum symbols are not visible outside the struct in C++.

Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com>
src/include/utils/jsonb.h

index fa52afcb5c3341e4a61decd47fb241659796eaed..48ca9dc913c38c5da866e5a129608aa18d602d9c 100644 (file)
@@ -219,6 +219,20 @@ typedef struct
 #define JB_ROOT_IS_ARRAY(jbp_) ( *(uint32*) VARDATA(jbp_) & JB_FARRAY)
 
 
+enum jbvType
+{
+       /* Scalar types */
+       jbvNull = 0x0,
+       jbvString,
+       jbvNumeric,
+       jbvBool,
+       /* Composite types */
+       jbvArray = 0x10,
+       jbvObject,
+       /* Binary (i.e. struct Jsonb) jbvArray/jbvObject */
+       jbvBinary
+};
+
 /*
  * JsonbValue: In-memory representation of Jsonb.  This is a convenient
  * deserialized representation, that can easily support using the "val"
@@ -227,19 +241,7 @@ typedef struct
  */
 struct JsonbValue
 {
-       enum
-       {
-               /* Scalar types */
-               jbvNull = 0x0,
-               jbvString,
-               jbvNumeric,
-               jbvBool,
-               /* Composite types */
-               jbvArray = 0x10,
-               jbvObject,
-               /* Binary (i.e. struct Jsonb) jbvArray/jbvObject */
-               jbvBinary
-       }                       type;                   /* Influences sort order */
+       jbvType         type;                   /* Influences sort order */
 
        union
        {