Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4bd1994

Browse files
committed
Make DatumGetFoo/PG_GETARG_FOO/PG_RETURN_FOO macro names more consistent.
By project convention, these names should include "P" when dealing with apointer type; that is, if the result of a GETARG macro is of type FOO *,it should be called PG_GETARG_FOO_P not just PG_GETARG_FOO. Some newertypes such as JSONB and ranges had not followed the convention, and anumber of contrib modules hadn't gotten that memo either. Rename theoffending macros to improve consistency.In passing, fix a few places that thought PG_DETOAST_DATUM() returnsa Datum; it does not, it returns "struct varlena *". ApplyingDatumGetPointer to that happens not to cause any bad effects today,but it's formally wrong. Also, adjust an ltree macro that was designedwithout any thought for what pgindent would do with it.This is all cosmetic and shouldn't have any impact on generated code.Mark Dilger, some further tweaks by meDiscussion:https://postgr.es/m/EA5676F4-766F-4F38-8348-ECC7DB427C6A@gmail.com
1 parent3e1683d commit4bd1994

38 files changed

+471
-461
lines changed

‎contrib/btree_gist/btree_text.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Datum
171171
gbt_bpchar_consistent(PG_FUNCTION_ARGS)
172172
{
173173
GISTENTRY*entry= (GISTENTRY*)PG_GETARG_POINTER(0);
174-
void*query= (void*)DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1)));
174+
void*query= (void*)DatumGetTextP(PG_GETARG_DATUM(1));
175175
StrategyNumberstrategy= (StrategyNumber)PG_GETARG_UINT16(2);
176176

177177
/* Oidsubtype = PG_GETARG_OID(3); */

‎contrib/btree_gist/btree_utils_var.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Datum
3737
gbt_var_decompress(PG_FUNCTION_ARGS)
3838
{
3939
GISTENTRY*entry= (GISTENTRY*)PG_GETARG_POINTER(0);
40-
GBT_VARKEY*key= (GBT_VARKEY*)DatumGetPointer(PG_DETOAST_DATUM(entry->key));
40+
GBT_VARKEY*key= (GBT_VARKEY*)PG_DETOAST_DATUM(entry->key);
4141

4242
if (key!= (GBT_VARKEY*)DatumGetPointer(entry->key))
4343
{
@@ -159,7 +159,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo)
159159
l--;
160160
i++;
161161
}
162-
returnml;/* lower == upper */
162+
returnml;/* lower == upper */
163163
}
164164

165165

@@ -307,7 +307,7 @@ Datum
307307
gbt_var_fetch(PG_FUNCTION_ARGS)
308308
{
309309
GISTENTRY*entry= (GISTENTRY*)PG_GETARG_POINTER(0);
310-
GBT_VARKEY*key= (GBT_VARKEY*)DatumGetPointer(PG_DETOAST_DATUM(entry->key));
310+
GBT_VARKEY*key= (GBT_VARKEY*)PG_DETOAST_DATUM(entry->key);
311311
GBT_VARKEY_Rr=gbt_var_key_readable(key);
312312
GISTENTRY*retval;
313313

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp