@@ -1068,7 +1068,7 @@ hstore_populate_record(PG_FUNCTION_ARGS)
10681068column_info -> column_type = column_type ;
10691069}
10701070
1071- if (idx < 0 || HS_VALISNULL (entries ,idx ))
1071+ if (idx < 0 || HSTORE_VALISNULL (entries ,idx ))
10721072{
10731073/*
10741074 * need InputFunctionCall to happen even for nulls, so that domain
@@ -1081,9 +1081,9 @@ hstore_populate_record(PG_FUNCTION_ARGS)
10811081}
10821082else
10831083{
1084- vallen = HS_VALLEN (entries ,idx );
1084+ vallen = HSTORE_VALLEN (entries ,idx );
10851085value = palloc (1 + vallen );
1086- memcpy (value ,HS_VAL (entries ,ptr ,idx ),vallen );
1086+ memcpy (value ,HSTORE_VAL (entries ,ptr ,idx ),vallen );
10871087value [vallen ]= 0 ;
10881088
10891089values [i ]= InputFunctionCall (& column_info -> proc ,value ,
@@ -1144,23 +1144,23 @@ hstore_out(PG_FUNCTION_ARGS)
11441144for (i = 0 ;i < count ;i ++ )
11451145{
11461146/* include "" and => and comma-space */
1147- buflen += 6 + 2 * HS_KEYLEN (entries ,i );
1147+ buflen += 6 + 2 * HSTORE_KEYLEN (entries ,i );
11481148/* include "" only if nonnull */
1149- buflen += 2 + (HS_VALISNULL (entries ,i )
1149+ buflen += 2 + (HSTORE_VALISNULL (entries ,i )
11501150 ?2
1151- :2 * HS_VALLEN (entries ,i ));
1151+ :2 * HSTORE_VALLEN (entries ,i ));
11521152}
11531153
11541154out = ptr = palloc (buflen );
11551155
11561156for (i = 0 ;i < count ;i ++ )
11571157{
11581158* ptr ++ = '"' ;
1159- ptr = cpw (ptr ,HS_KEY (entries ,base ,i ),HS_KEYLEN (entries ,i ));
1159+ ptr = cpw (ptr ,HSTORE_KEY (entries ,base ,i ),HSTORE_KEYLEN (entries ,i ));
11601160* ptr ++ = '"' ;
11611161* ptr ++ = '=' ;
11621162* ptr ++ = '>' ;
1163- if (HS_VALISNULL (entries ,i ))
1163+ if (HSTORE_VALISNULL (entries ,i ))
11641164{
11651165* ptr ++ = 'N' ;
11661166* ptr ++ = 'U' ;
@@ -1170,7 +1170,7 @@ hstore_out(PG_FUNCTION_ARGS)
11701170else
11711171{
11721172* ptr ++ = '"' ;
1173- ptr = cpw (ptr ,HS_VAL (entries ,base ,i ),HS_VALLEN (entries ,i ));
1173+ ptr = cpw (ptr ,HSTORE_VAL (entries ,base ,i ),HSTORE_VALLEN (entries ,i ));
11741174* ptr ++ = '"' ;
11751175}
11761176
@@ -1203,20 +1203,20 @@ hstore_send(PG_FUNCTION_ARGS)
12031203
12041204for (i = 0 ;i < count ;i ++ )
12051205{
1206- int32 keylen = HS_KEYLEN (entries ,i );
1206+ int32 keylen = HSTORE_KEYLEN (entries ,i );
12071207
12081208pq_sendint (& buf ,keylen ,4 );
1209- pq_sendtext (& buf ,HS_KEY (entries ,base ,i ),keylen );
1210- if (HS_VALISNULL (entries ,i ))
1209+ pq_sendtext (& buf ,HSTORE_KEY (entries ,base ,i ),keylen );
1210+ if (HSTORE_VALISNULL (entries ,i ))
12111211{
12121212pq_sendint (& buf ,-1 ,4 );
12131213}
12141214else
12151215{
1216- int32 vallen = HS_VALLEN (entries ,i );
1216+ int32 vallen = HSTORE_VALLEN (entries ,i );
12171217
12181218pq_sendint (& buf ,vallen ,4 );
1219- pq_sendtext (& buf ,HS_VAL (entries ,base ,i ),vallen );
1219+ pq_sendtext (& buf ,HSTORE_VAL (entries ,base ,i ),vallen );
12201220}
12211221}
12221222
@@ -1255,20 +1255,24 @@ hstore_to_json_loose(PG_FUNCTION_ARGS)
12551255for (i = 0 ;i < count ;i ++ )
12561256{
12571257resetStringInfo (& tmp );
1258- appendBinaryStringInfo (& tmp ,HS_KEY (entries ,base ,i ),HS_KEYLEN (entries ,i ));
1258+ appendBinaryStringInfo (& tmp ,HSTORE_KEY (entries ,base ,i ),
1259+ HSTORE_KEYLEN (entries ,i ));
12591260escape_json (& dst ,tmp .data );
12601261appendStringInfoString (& dst ,": " );
1261- if (HS_VALISNULL (entries ,i ))
1262+ if (HSTORE_VALISNULL (entries ,i ))
12621263appendStringInfoString (& dst ,"null" );
12631264/* guess that values of 't' or 'f' are booleans */
1264- else if (HS_VALLEN (entries ,i )== 1 && * (HS_VAL (entries ,base ,i ))== 't' )
1265+ else if (HSTORE_VALLEN (entries ,i )== 1 &&
1266+ * (HSTORE_VAL (entries ,base ,i ))== 't' )
12651267appendStringInfoString (& dst ,"true" );
1266- else if (HS_VALLEN (entries ,i )== 1 && * (HS_VAL (entries ,base ,i ))== 'f' )
1268+ else if (HSTORE_VALLEN (entries ,i )== 1 &&
1269+ * (HSTORE_VAL (entries ,base ,i ))== 'f' )
12671270appendStringInfoString (& dst ,"false" );
12681271else
12691272{
12701273resetStringInfo (& tmp );
1271- appendBinaryStringInfo (& tmp ,HS_VAL (entries ,base ,i ),HS_VALLEN (entries ,i ));
1274+ appendBinaryStringInfo (& tmp ,HSTORE_VAL (entries ,base ,i ),
1275+ HSTORE_VALLEN (entries ,i ));
12721276if (IsValidJsonNumber (tmp .data ,tmp .len ))
12731277appendBinaryStringInfo (& dst ,tmp .data ,tmp .len );
12741278else
@@ -1306,15 +1310,17 @@ hstore_to_json(PG_FUNCTION_ARGS)
13061310for (i = 0 ;i < count ;i ++ )
13071311{
13081312resetStringInfo (& tmp );
1309- appendBinaryStringInfo (& tmp ,HS_KEY (entries ,base ,i ),HS_KEYLEN (entries ,i ));
1313+ appendBinaryStringInfo (& tmp ,HSTORE_KEY (entries ,base ,i ),
1314+ HSTORE_KEYLEN (entries ,i ));
13101315escape_json (& dst ,tmp .data );
13111316appendStringInfoString (& dst ,": " );
1312- if (HS_VALISNULL (entries ,i ))
1317+ if (HSTORE_VALISNULL (entries ,i ))
13131318appendStringInfoString (& dst ,"null" );
13141319else
13151320{
13161321resetStringInfo (& tmp );
1317- appendBinaryStringInfo (& tmp ,HS_VAL (entries ,base ,i ),HS_VALLEN (entries ,i ));
1322+ appendBinaryStringInfo (& tmp ,HSTORE_VAL (entries ,base ,i ),
1323+ HSTORE_VALLEN (entries ,i ));
13181324escape_json (& dst ,tmp .data );
13191325}
13201326
@@ -1346,20 +1352,20 @@ hstore_to_jsonb(PG_FUNCTION_ARGS)
13461352val ;
13471353
13481354key .type = jbvString ;
1349- key .val .string .len = HS_KEYLEN (entries ,i );
1350- key .val .string .val = HS_KEY (entries ,base ,i );
1355+ key .val .string .len = HSTORE_KEYLEN (entries ,i );
1356+ key .val .string .val = HSTORE_KEY (entries ,base ,i );
13511357
13521358(void )pushJsonbValue (& state ,WJB_KEY ,& key );
13531359
1354- if (HS_VALISNULL (entries ,i ))
1360+ if (HSTORE_VALISNULL (entries ,i ))
13551361{
13561362val .type = jbvNull ;
13571363}
13581364else
13591365{
13601366val .type = jbvString ;
1361- val .val .string .len = HS_VALLEN (entries ,i );
1362- val .val .string .val = HS_VAL (entries ,base ,i );
1367+ val .val .string .len = HSTORE_VALLEN (entries ,i );
1368+ val .val .string .val = HSTORE_VAL (entries ,base ,i );
13631369}
13641370(void )pushJsonbValue (& state ,WJB_VALUE ,& val );
13651371}
@@ -1393,22 +1399,24 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
13931399val ;
13941400
13951401key .type = jbvString ;
1396- key .val .string .len = HS_KEYLEN (entries ,i );
1397- key .val .string .val = HS_KEY (entries ,base ,i );
1402+ key .val .string .len = HSTORE_KEYLEN (entries ,i );
1403+ key .val .string .val = HSTORE_KEY (entries ,base ,i );
13981404
13991405(void )pushJsonbValue (& state ,WJB_KEY ,& key );
14001406
1401- if (HS_VALISNULL (entries ,i ))
1407+ if (HSTORE_VALISNULL (entries ,i ))
14021408{
14031409val .type = jbvNull ;
14041410}
14051411/* guess that values of 't' or 'f' are booleans */
1406- else if (HS_VALLEN (entries ,i )== 1 && * (HS_VAL (entries ,base ,i ))== 't' )
1412+ else if (HSTORE_VALLEN (entries ,i )== 1 &&
1413+ * (HSTORE_VAL (entries ,base ,i ))== 't' )
14071414{
14081415val .type = jbvBool ;
14091416val .val .boolean = true;
14101417}
1411- else if (HS_VALLEN (entries ,i )== 1 && * (HS_VAL (entries ,base ,i ))== 'f' )
1418+ else if (HSTORE_VALLEN (entries ,i )== 1 &&
1419+ * (HSTORE_VAL (entries ,base ,i ))== 'f' )
14121420{
14131421val .type = jbvBool ;
14141422val .val .boolean = false;
@@ -1418,7 +1426,8 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
14181426is_number = false;
14191427resetStringInfo (& tmp );
14201428
1421- appendBinaryStringInfo (& tmp ,HS_VAL (entries ,base ,i ),HS_VALLEN (entries ,i ));
1429+ appendBinaryStringInfo (& tmp ,HSTORE_VAL (entries ,base ,i ),
1430+ HSTORE_VALLEN (entries ,i ));
14221431
14231432/*
14241433 * don't treat something with a leading zero followed by another
@@ -1461,14 +1470,14 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS)
14611470{
14621471val .type = jbvNumeric ;
14631472val .val .numeric = DatumGetNumeric (
1464- DirectFunctionCall3 (numeric_in ,CStringGetDatum ( tmp . data ), 0 , -1 ));
1465-
1473+ DirectFunctionCall3 (numeric_in ,
1474+ CStringGetDatum ( tmp . data ), 0 , -1 ));
14661475}
14671476else
14681477{
14691478val .type = jbvString ;
1470- val .val .string .len = HS_VALLEN (entries ,i );
1471- val .val .string .val = HS_VAL (entries ,base ,i );
1479+ val .val .string .len = HSTORE_VALLEN (entries ,i );
1480+ val .val .string .val = HSTORE_VAL (entries ,base ,i );
14721481}
14731482}
14741483(void )pushJsonbValue (& state ,WJB_VALUE ,& val );