Skip to content

Commit 3edc71e

Browse files
committed
Convert macros to static inline functions (rel.h)
Reviewed-by: Amul Sul <sulamul@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/5b558da8-99fb-0a99-83dd-f72f05388517%40enterprisedb.com
1 parent f14aad5 commit 3edc71e

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/include/utils/rel.h

+10-11
Original file line numberDiff line numberDiff line change
@@ -572,22 +572,21 @@ RelationGetSmgr(Relation rel)
572572
smgrsetowner(&(rel->rd_smgr), smgropen(rel->rd_locator, rel->rd_backend));
573573
return rel->rd_smgr;
574574
}
575-
#endif
576575

577576
/*
578577
* RelationCloseSmgr
579578
* Close the relation at the smgr level, if not already done.
580-
*
581-
* Note: smgrclose should unhook from owner pointer, hence the Assert.
582579
*/
583-
#define RelationCloseSmgr(relation) \
584-
do { \
585-
if ((relation)->rd_smgr != NULL) \
586-
{ \
587-
smgrclose((relation)->rd_smgr); \
588-
Assert((relation)->rd_smgr == NULL); \
589-
} \
590-
} while (0)
580+
static inline void
581+
RelationCloseSmgr(Relation relation)
582+
{
583+
if (relation->rd_smgr != NULL)
584+
smgrclose(relation->rd_smgr);
585+
586+
/* smgrclose should unhook from owner pointer */
587+
Assert(relation->rd_smgr == NULL);
588+
}
589+
#endif /* !FRONTEND */
591590

592591
/*
593592
* RelationGetTargetBlock

0 commit comments

Comments
 (0)