Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d43085d

Browse files
committed
pageinspect: Use better macros to get special page area for GIN and GiST
These five code paths are the last ones that made use of PageGetSpecialPointer() to get the special area of such pages, while those index AMs have already macros to do this job. Noticed while reviewing the use PageGetSpecialPointer() in the whole tree, in relation to the recent commit d16773c.
1 parent 465ab24 commit d43085d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

contrib/pageinspect/ginfuncs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ gin_metapage_info(PG_FUNCTION_ARGS)
5757
(int) MAXALIGN(sizeof(GinPageOpaqueData)),
5858
(int) PageGetSpecialSize(page))));
5959

60-
opaq = (GinPageOpaque) PageGetSpecialPointer(page);
60+
opaq = GinPageGetOpaque(page);
6161
if (opaq->flags != GIN_META)
6262
ereport(ERROR,
6363
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -123,7 +123,7 @@ gin_page_opaque_info(PG_FUNCTION_ARGS)
123123
(int) MAXALIGN(sizeof(GinPageOpaqueData)),
124124
(int) PageGetSpecialSize(page))));
125125

126-
opaq = (GinPageOpaque) PageGetSpecialPointer(page);
126+
opaq = GinPageGetOpaque(page);
127127

128128
/* Build a tuple descriptor for our result type */
129129
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
@@ -208,7 +208,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS)
208208
(int) MAXALIGN(sizeof(GinPageOpaqueData)),
209209
(int) PageGetSpecialSize(page))));
210210

211-
opaq = (GinPageOpaque) PageGetSpecialPointer(page);
211+
opaq = GinPageGetOpaque(page);
212212
if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED))
213213
ereport(ERROR,
214214
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

contrib/pageinspect/gistfuncs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ gist_page_opaque_info(PG_FUNCTION_ARGS)
6464
(int) MAXALIGN(sizeof(GISTPageOpaqueData)),
6565
(int) PageGetSpecialSize(page))));
6666

67-
opaq = (GISTPageOpaque) PageGetSpecialPointer(page);
67+
opaq = GistPageGetOpaque(page);
6868
if (opaq->gist_page_id != GIST_PAGE_ID)
6969
ereport(ERROR,
7070
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
@@ -139,7 +139,7 @@ gist_page_items_bytea(PG_FUNCTION_ARGS)
139139
(int) MAXALIGN(sizeof(GISTPageOpaqueData)),
140140
(int) PageGetSpecialSize(page))));
141141

142-
opaq = (GISTPageOpaque) PageGetSpecialPointer(page);
142+
opaq = GistPageGetOpaque(page);
143143
if (opaq->gist_page_id != GIST_PAGE_ID)
144144
ereport(ERROR,
145145
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

0 commit comments

Comments
 (0)