Skip to content

Commit

Permalink
Regroup and renumber ModelConstants
Browse files Browse the repository at this point in the history
Given support for gaps in the ModelConstants IDX_... values,
renumber and slightly regroup the constants, with an eye
toward reducing the blast radius of future additions when
needed.
  • Loading branch information
jcflack committed Sep 8, 2023
1 parent e511a12 commit dc62b4e
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 80 deletions.
28 changes: 23 additions & 5 deletions pljava-so/src/main/c/ModelConstants.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,15 @@ static int32 constants[] = {

CONSTANT(NAMEDATALEN),



CONSTANTEXPR(SIZEOF_varatt_indirect, sizeof (varatt_indirect)),
CONSTANTEXPR(SIZEOF_varatt_expanded, sizeof (varatt_expanded)),
CONSTANTEXPR(SIZEOF_varatt_external, sizeof (varatt_external)),



CONSTANT(HEAPTUPLESIZE),
CONSTANTEXPR(OFFSET_TTS_NVALID, offsetof(TupleTableSlot, tts_nvalid)),
CONSTANTEXPR(SIZEOF_TTS_NVALID, sizeof ((TupleTableSlot *)0)->tts_nvalid),

Expand All @@ -121,10 +126,7 @@ static int32 constants[] = {
NOCONSTANT(OFFSET_TTS_TABLEOID),
#endif /* 120000 */

CONSTANTEXPR(SIZEOF_FORM_PG_ATTRIBUTE, sizeof (FormData_pg_attribute)),
CONSTANT(ATTRIBUTE_FIXED_PART_SIZE),
CONSTANT(CLASS_TUPLE_SIZE),
CONSTANT(HEAPTUPLESIZE),


CONSTANTEXPR(OFFSET_TUPLEDESC_ATTRS, offsetof(struct TupleDescData, attrs)),
CONSTANTEXPR(OFFSET_TUPLEDESC_TDREFCOUNT,
Expand All @@ -136,6 +138,10 @@ static int32 constants[] = {
CONSTANTEXPR(OFFSET_TUPLEDESC_TDTYPMOD,
offsetof(struct TupleDescData, tdtypmod)),



CONSTANTEXPR(SIZEOF_FORM_PG_ATTRIBUTE, sizeof (FormData_pg_attribute)),
CONSTANT(ATTRIBUTE_FIXED_PART_SIZE),
FORMOFFSET( pg_attribute, atttypid ),
FORMOFFSET( pg_attribute, attlen ),
FORMOFFSET( pg_attribute, attcacheoff ),
Expand All @@ -145,8 +151,13 @@ static int32 constants[] = {
FORMOFFSET( pg_attribute, attnotnull ),
FORMOFFSET( pg_attribute, attisdropped ),



CONSTANT(CLASS_TUPLE_SIZE),
CONSTANT( Anum_pg_class_reltype ),



CONSTANTEXPR(SIZEOF_MCTX, sizeof (MemoryContextData)),
TYPEOFFSET(MemoryContextData, MCTX, isReset),
TYPEOFFSET(MemoryContextData, MCTX, mem_allocated),
Expand All @@ -157,6 +168,12 @@ static int32 constants[] = {
TYPEOFFSET(MemoryContextData, MCTX, name),
TYPEOFFSET(MemoryContextData, MCTX, ident),



CONSTANT(N_ACL_RIGHTS),



CONSTANT(ATTNUM),
CONSTANT(AUTHMEMMEMROLE),
CONSTANT(AUTHMEMROLEMEM),
Expand All @@ -172,7 +189,8 @@ static int32 constants[] = {
CONSTANT(TSDICTOID),
CONSTANT(TYPEOID),

CONSTANT(N_ACL_RIGHTS),


};

#undef CONSTANT
Expand Down
Loading

0 comments on commit dc62b4e

Please sign in to comment.