Correct serialize/deserialize confusion
authorPeter Geoghegan <[email protected]>
Wed, 12 Mar 2014 22:54:27 +0000 (15:54 -0700)
committerPeter Geoghegan <[email protected]>
Wed, 12 Mar 2014 22:54:27 +0000 (15:54 -0700)
src/backend/utils/adt/jsonb.c
src/include/utils/jsonb.h

index e3357003d1def33bf4aecd0bee9317a8a9ed1d39..ddb6e6929c5e1f0f6d679882b688be2c39b12c16 100644 (file)
@@ -23,7 +23,7 @@ typedef struct JsonbInState
    JsonbValue *res;
 }  JsonbInState;
 
-static inline Datum deserialize_json_text(char *json, int len);
+static inline Datum serialize_json_text(char *json, int len);
 static size_t checkStringLen(size_t len);
 static void jsonb_in_object_start(void *state);
 static void jsonb_in_object_end(void *state);
@@ -42,7 +42,7 @@ jsonb_in(PG_FUNCTION_ARGS)
 {
    char       *json = PG_GETARG_CSTRING(0);
 
-   return deserialize_json_text(json, strlen(json));
+   return serialize_json_text(json, strlen(json));
 }
 
 /*
@@ -66,7 +66,7 @@ jsonb_recv(PG_FUNCTION_ARGS)
    else
        elog(ERROR, "Unsupported jsonb version number %d", version);
 
-   return deserialize_json_text(str, nbytes);
+   return serialize_json_text(str, nbytes);
 }
 
 /*
@@ -161,14 +161,14 @@ jsonb_typeof(PG_FUNCTION_ARGS)
 }
 
 /*
- * deserialize_json_text
+ * serialize_json_text
  *
- * turn json text into a jsonb Datum.
+ * Turn json text into a jsonb Datum.
  *
- * uses the json parser with hooks to contruct the jsonb.
+ * Uses the json parser with hooks to contruct a jsonb.
  */
 static inline Datum
-deserialize_json_text(char *json, int len)
+serialize_json_text(char *json, int len)
 {
    JsonLexContext *lex;
    JsonbInState state;
index 8a3ac83680c0aea53b6bdc232c618cae36a04ecd..06bf3af20011383b5b6952f793d36d1330c76404 100644 (file)
@@ -197,8 +197,7 @@ typedef struct JsonbIterator
    char       *dataProper;
 
    /*
-    * Enum members should be freely OR'ed with JB_FLAG_ARRAY/JB_FLAG_OBJECT
-    * with possibility of decoding.
+    * Enum members are OR'ed with JB_FLAG_ARRAY/JB_FLAG_OBJECT.
     *
     * See optimization in JsonbIteratorNext()
     */