Remove bits* typedefs.

In addition to removing the bits8, bits16, and bits32 typedefs,
this commit replaces all uses with uint8, uint16, or uint32.  bits*
provided little benefit beyond establishing the intent of the
variable, and they were inconsistently used for that purpose.
Third-party code should instead use the corresponding uint*
typedef.

Suggested-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/absbX33E4eaA0Ity%40nathan
This commit is contained in:
Nathan Bossart 2026-03-30 16:12:08 -05:00
parent 40c41dc773
commit bab2f27eaa
73 changed files with 261 additions and 273 deletions

View file

@ -2077,7 +2077,7 @@ get_text_array_contents(ArrayType *array, int *numitems)
uint8 typalignby;
char **values;
char *ptr;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
int i;

View file

@ -203,7 +203,7 @@ gist_page_items(PG_FUNCTION_ARGS)
TupleDesc tupdesc;
Page page;
uint16 flagbits;
bits16 printflags = 0;
uint16 printflags = 0;
OffsetNumber offset;
OffsetNumber maxoff = InvalidOffsetNumber;
char *index_columns;

View file

@ -56,11 +56,11 @@ HeapTupleHeaderGetOidOld(const HeapTupleHeaderData *tup)
/*
* bits_to_text
*
* Converts a bits8-array of 'len' bits to a human-readable
* Converts a uint8-array of 'len' bits to a human-readable
* c-string representation.
*/
static char *
bits_to_text(bits8 *bits, int len)
bits_to_text(uint8 *bits, int len)
{
int i;
char *str;
@ -79,13 +79,13 @@ bits_to_text(bits8 *bits, int len)
/*
* text_to_bits
*
* Converts a c-string representation of bits into a bits8-array. This is
* Converts a c-string representation of bits into a uint8-array. This is
* the reverse operation of previous routine.
*/
static bits8 *
static uint8 *
text_to_bits(char *str, int len)
{
bits8 *bits;
uint8 *bits;
int off = 0;
char byte = 0;
@ -305,7 +305,7 @@ heap_page_items(PG_FUNCTION_ARGS)
static Datum
tuple_data_split_internal(Oid relid, char *tupdata,
uint16 tupdata_len, uint16 t_infomask,
uint16 t_infomask2, bits8 *t_bits,
uint16 t_infomask2, uint8 *t_bits,
bool do_detoast)
{
ArrayBuildState *raw_attrs;
@ -434,7 +434,7 @@ tuple_data_split(PG_FUNCTION_ARGS)
uint16 t_infomask2;
char *t_bits_str;
bool do_detoast = false;
bits8 *t_bits = NULL;
uint8 *t_bits = NULL;
Datum res;
relid = PG_GETARG_OID(0);
@ -456,7 +456,7 @@ tuple_data_split(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
/*
* Convert t_bits string back to the bits8 array as represented in the
* Convert t_bits string back to the uint8 array as represented in the
* tuple header.
*/
if (t_infomask & HEAP_HASNULL)

View file

@ -1189,7 +1189,7 @@ is_foreign_pathkey(PlannerInfo *root,
static char *
deparse_type_name(Oid type_oid, int32 typemod)
{
bits16 flags = FORMAT_TYPE_TYPEMOD_GIVEN;
uint16 flags = FORMAT_TYPE_TYPEMOD_GIVEN;
if (!is_builtin(type_oid))
flags |= FORMAT_TYPE_FORCE_QUALIFY;

View file

@ -1702,7 +1702,7 @@ ReparameterizeForeignPathByChild(PlannerInfo *root, List *fdw_private,
<para>
<programlisting>
ForeignDataWrapper *
GetForeignDataWrapperExtended(Oid fdwid, bits16 flags);
GetForeignDataWrapperExtended(Oid fdwid, uint16 flags);
</programlisting>
This function returns a <structname>ForeignDataWrapper</structname>
@ -1731,7 +1731,7 @@ GetForeignDataWrapper(Oid fdwid);
<para>
<programlisting>
ForeignServer *
GetForeignServerExtended(Oid serverid, bits16 flags);
GetForeignServerExtended(Oid serverid, uint16 flags);
</programlisting>
This function returns a <structname>ForeignServer</structname> object

View file

@ -50,7 +50,7 @@
static inline void brin_deconstruct_tuple(BrinDesc *brdesc,
char *tp, bits8 *nullbits, bool nulls,
char *tp, uint8 *nullbits, bool nulls,
Datum *values, bool *allnulls, bool *hasnulls);
@ -107,7 +107,7 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
int keyno;
int idxattno;
uint16 phony_infomask = 0;
bits8 *phony_nullbitmap;
uint8 *phony_nullbitmap;
Size len,
hoff,
data_len;
@ -122,7 +122,7 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
values = palloc_array(Datum, brdesc->bd_totalstored);
nulls = palloc0_array(bool, brdesc->bd_totalstored);
phony_nullbitmap = palloc_array(bits8, BITMAPLEN(brdesc->bd_totalstored));
phony_nullbitmap = palloc_array(uint8, BITMAPLEN(brdesc->bd_totalstored));
#ifdef TOAST_INDEX_HACK
untoasted_values = palloc_array(Datum, brdesc->bd_totalstored);
@ -322,7 +322,7 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
*/
if (anynulls)
{
bits8 *bitP;
uint8 *bitP;
int bitmask;
rettuple->bt_info |= BRIN_NULLS_MASK;
@ -332,7 +332,7 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
* store a 1 for a null attribute rather than a 0. So we must reverse
* the sense of the att_isnull test in brin_deconstruct_tuple as well.
*/
bitP = ((bits8 *) ((char *) rettuple + SizeOfBrinTuple)) - 1;
bitP = ((uint8 *) ((char *) rettuple + SizeOfBrinTuple)) - 1;
bitmask = HIGHBIT;
for (keyno = 0; keyno < brdesc->bd_tupdesc->natts; keyno++)
{
@ -391,7 +391,7 @@ brin_form_placeholder_tuple(BrinDesc *brdesc, BlockNumber blkno, Size *size)
Size hoff;
BrinTuple *rettuple;
int keyno;
bits8 *bitP;
uint8 *bitP;
int bitmask;
/* compute total space needed: always add nulls */
@ -404,7 +404,7 @@ brin_form_placeholder_tuple(BrinDesc *brdesc, BlockNumber blkno, Size *size)
rettuple->bt_info = hoff;
rettuple->bt_info |= BRIN_NULLS_MASK | BRIN_PLACEHOLDER_MASK | BRIN_EMPTY_RANGE_MASK;
bitP = ((bits8 *) ((char *) rettuple + SizeOfBrinTuple)) - 1;
bitP = ((uint8 *) ((char *) rettuple + SizeOfBrinTuple)) - 1;
bitmask = HIGHBIT;
/* set allnulls true for all attributes */
for (keyno = 0; keyno < brdesc->bd_tupdesc->natts; keyno++)
@ -557,7 +557,7 @@ brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
bool *allnulls;
bool *hasnulls;
char *tp;
bits8 *nullbits;
uint8 *nullbits;
int keyno;
int valueno;
MemoryContext oldcxt;
@ -581,7 +581,7 @@ brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
tp = (char *) tuple + BrinTupleDataOffset(tuple);
if (BrinTupleHasNulls(tuple))
nullbits = (bits8 *) ((char *) tuple + SizeOfBrinTuple);
nullbits = (uint8 *) ((char *) tuple + SizeOfBrinTuple);
else
nullbits = NULL;
brin_deconstruct_tuple(brdesc,
@ -643,7 +643,7 @@ brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
*/
static inline void
brin_deconstruct_tuple(BrinDesc *brdesc,
char *tp, bits8 *nullbits, bool nulls,
char *tp, uint8 *nullbits, bool nulls,
Datum *values, bool *allnulls, bool *hasnulls)
{
int attnum;

View file

@ -273,7 +273,7 @@ heap_compute_data_size(TupleDesc tupleDesc,
*/
static inline void
fill_val(CompactAttribute *att,
bits8 **bit,
uint8 **bit,
int *bitmask,
char **dataP,
uint16 *infomask,
@ -401,9 +401,9 @@ void
heap_fill_tuple(TupleDesc tupleDesc,
const Datum *values, const bool *isnull,
char *data, Size data_size,
uint16 *infomask, bits8 *bit)
uint16 *infomask, uint8 *bit)
{
bits8 *bitP;
uint8 *bitP;
int bitmask;
int i;
int numberOfAttributes = tupleDesc->natts;
@ -513,7 +513,7 @@ nocachegetattr(HeapTuple tup,
CompactAttribute *cattr;
HeapTupleHeader td = tup->t_data;
char *tp; /* ptr to data part of tuple */
bits8 *bp = td->t_bits; /* ptr to null bitmap in tuple */
uint8 *bp = td->t_bits; /* ptr to null bitmap in tuple */
int off; /* current offset within data */
int startAttr;
int firstNullAttr;
@ -766,7 +766,7 @@ expand_tuple(HeapTuple *targetHeapTuple,
Size targetDataLen;
Size len;
int hoff;
bits8 *nullBits = NULL;
uint8 *nullBits = NULL;
int bitMask = 0;
char *targetData;
uint16 *infoMask;
@ -878,7 +878,7 @@ expand_tuple(HeapTuple *targetHeapTuple,
/* We also make sure that t_ctid is invalid unless explicitly set */
ItemPointerSetInvalid(&(targetTHeader->t_ctid));
if (targetNullLen > 0)
nullBits = (bits8 *) ((char *) (*targetHeapTuple)->t_data
nullBits = (uint8 *) ((char *) (*targetHeapTuple)->t_data
+ offsetof(HeapTupleHeaderData, t_bits));
targetData = (char *) (*targetHeapTuple)->t_data + hoff;
infoMask = &(targetTHeader->t_infomask);
@ -896,7 +896,7 @@ expand_tuple(HeapTuple *targetHeapTuple,
/* Same macro works for MinimalTuples */
HeapTupleHeaderSetNatts(*targetMinimalTuple, natts);
if (targetNullLen > 0)
nullBits = (bits8 *) ((char *) *targetMinimalTuple
nullBits = (uint8 *) ((char *) *targetMinimalTuple
+ offsetof(MinimalTupleData, t_bits));
targetData = (char *) *targetMinimalTuple + hoff;
infoMask = &((*targetMinimalTuple)->t_infomask);
@ -1274,7 +1274,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
int attnum;
char *tp; /* ptr to tuple data */
uint32 off; /* offset in tuple data */
bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
uint8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
int firstNonCacheOffsetAttr;
int firstNullAttr;

View file

@ -175,7 +175,7 @@ index_form_tuple_context(TupleDesc tupleDescriptor,
tp + hoff,
data_size,
&tupmask,
(hasnull ? (bits8 *) tp + sizeof(IndexTupleData) : NULL));
(hasnull ? (uint8 *) tp + sizeof(IndexTupleData) : NULL));
#ifdef TOAST_INDEX_HACK
for (i = 0; i < numberOfAttributes; i++)
@ -232,7 +232,7 @@ nocache_index_getattr(IndexTuple tup,
{
CompactAttribute *cattr;
char *tp; /* ptr to data part of tuple */
bits8 *bp = NULL; /* ptr to null bitmap in tuple */
uint8 *bp = NULL; /* ptr to null bitmap in tuple */
int data_off; /* tuple data offset */
int off; /* current offset within data */
int startAttr;
@ -255,7 +255,7 @@ nocache_index_getattr(IndexTuple tup,
*/
if (hasnulls)
{
bp = (bits8 *) ((char *) tup + sizeof(IndexTupleData));
bp = (uint8 *) ((char *) tup + sizeof(IndexTupleData));
firstNullAttr = first_null_attr(bp, attnum);
}
else
@ -365,10 +365,10 @@ index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
Datum *values, bool *isnull)
{
char *tp; /* ptr to tuple data */
bits8 *bp; /* ptr to null bitmap in tuple */
uint8 *bp; /* ptr to null bitmap in tuple */
/* XXX "knows" t_bits are just after fixed tuple header! */
bp = (bits8 *) ((char *) tup + sizeof(IndexTupleData));
bp = (uint8 *) ((char *) tup + sizeof(IndexTupleData));
tp = (char *) tup + IndexInfoFindDataOffset(tup->t_info);
@ -386,7 +386,7 @@ index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
void
index_deform_tuple_internal(TupleDesc tupleDescriptor,
Datum *values, bool *isnull,
char *tp, bits8 *bp, int hasnulls)
char *tp, uint8 *bp, int hasnulls)
{
CompactAttribute *cattr;
int natts = tupleDescriptor->natts; /* number of atts to extract */

View file

@ -585,7 +585,7 @@ static relopt_string stringRelOpts[] =
};
static relopt_gen **relOpts = NULL;
static bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT;
static uint32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT;
static int num_custom_options = 0;
static relopt_gen **custom_options = NULL;
@ -821,7 +821,7 @@ add_local_reloption(local_relopts *relopts, relopt_gen *newoption, int offset)
* (for types other than string)
*/
static relopt_gen *
allocate_reloption(bits32 kinds, int type, const char *name, const char *desc,
allocate_reloption(uint32 kinds, int type, const char *name, const char *desc,
LOCKMODE lockmode)
{
MemoryContext oldcxt;
@ -881,7 +881,7 @@ allocate_reloption(bits32 kinds, int type, const char *name, const char *desc,
* Allocate and initialize a new boolean reloption
*/
static relopt_bool *
init_bool_reloption(bits32 kinds, const char *name, const char *desc,
init_bool_reloption(uint32 kinds, const char *name, const char *desc,
bool default_val, LOCKMODE lockmode)
{
relopt_bool *newoption;
@ -898,7 +898,7 @@ init_bool_reloption(bits32 kinds, const char *name, const char *desc,
* Add a new boolean reloption
*/
void
add_bool_reloption(bits32 kinds, const char *name, const char *desc,
add_bool_reloption(uint32 kinds, const char *name, const char *desc,
bool default_val, LOCKMODE lockmode)
{
relopt_bool *newoption = init_bool_reloption(kinds, name, desc,
@ -929,7 +929,7 @@ add_local_bool_reloption(local_relopts *relopts, const char *name,
* Allocate and initialize a new ternary reloption
*/
static relopt_ternary *
init_ternary_reloption(bits32 kinds, const char *name, const char *desc,
init_ternary_reloption(uint32 kinds, const char *name, const char *desc,
LOCKMODE lockmode)
{
relopt_ternary *newoption;
@ -945,7 +945,7 @@ init_ternary_reloption(bits32 kinds, const char *name, const char *desc,
* Add a new ternary reloption
*/
void
add_ternary_reloption(bits32 kinds, const char *name, const char *desc,
add_ternary_reloption(uint32 kinds, const char *name, const char *desc,
LOCKMODE lockmode)
{
relopt_ternary *newoption;
@ -979,7 +979,7 @@ add_local_ternary_reloption(local_relopts *relopts, const char *name,
* Allocate and initialize a new integer reloption
*/
static relopt_int *
init_int_reloption(bits32 kinds, const char *name, const char *desc,
init_int_reloption(uint32 kinds, const char *name, const char *desc,
int default_val, int min_val, int max_val,
LOCKMODE lockmode)
{
@ -999,7 +999,7 @@ init_int_reloption(bits32 kinds, const char *name, const char *desc,
* Add a new integer reloption
*/
void
add_int_reloption(bits32 kinds, const char *name, const char *desc, int default_val,
add_int_reloption(uint32 kinds, const char *name, const char *desc, int default_val,
int min_val, int max_val, LOCKMODE lockmode)
{
relopt_int *newoption = init_int_reloption(kinds, name, desc,
@ -1032,7 +1032,7 @@ add_local_int_reloption(local_relopts *relopts, const char *name,
* Allocate and initialize a new real reloption
*/
static relopt_real *
init_real_reloption(bits32 kinds, const char *name, const char *desc,
init_real_reloption(uint32 kinds, const char *name, const char *desc,
double default_val, double min_val, double max_val,
LOCKMODE lockmode)
{
@ -1052,7 +1052,7 @@ init_real_reloption(bits32 kinds, const char *name, const char *desc,
* Add a new float reloption
*/
void
add_real_reloption(bits32 kinds, const char *name, const char *desc,
add_real_reloption(uint32 kinds, const char *name, const char *desc,
double default_val, double min_val, double max_val,
LOCKMODE lockmode)
{
@ -1087,7 +1087,7 @@ add_local_real_reloption(local_relopts *relopts, const char *name,
* Allocate and initialize a new enum reloption
*/
static relopt_enum *
init_enum_reloption(bits32 kinds, const char *name, const char *desc,
init_enum_reloption(uint32 kinds, const char *name, const char *desc,
relopt_enum_elt_def *members, int default_val,
const char *detailmsg, LOCKMODE lockmode)
{
@ -1116,7 +1116,7 @@ init_enum_reloption(bits32 kinds, const char *name, const char *desc,
* they are valid throughout the life of the process.
*/
void
add_enum_reloption(bits32 kinds, const char *name, const char *desc,
add_enum_reloption(uint32 kinds, const char *name, const char *desc,
relopt_enum_elt_def *members, int default_val,
const char *detailmsg, LOCKMODE lockmode)
{
@ -1151,7 +1151,7 @@ add_local_enum_reloption(local_relopts *relopts, const char *name,
* Allocate and initialize a new string reloption
*/
static relopt_string *
init_string_reloption(bits32 kinds, const char *name, const char *desc,
init_string_reloption(uint32 kinds, const char *name, const char *desc,
const char *default_val,
validate_string_relopt validator,
fill_string_relopt filler,
@ -1196,7 +1196,7 @@ init_string_reloption(bits32 kinds, const char *name, const char *desc,
* the validation.
*/
void
add_string_reloption(bits32 kinds, const char *name, const char *desc,
add_string_reloption(uint32 kinds, const char *name, const char *desc,
const char *default_val, validate_string_relopt validator,
LOCKMODE lockmode)
{

View file

@ -929,12 +929,12 @@ spgFormLeafTuple(SpGistState *state, const ItemPointerData *heapPtr,
if (needs_null_mask)
{
bits8 *bp; /* ptr to null bitmap in tuple */
uint8 *bp; /* ptr to null bitmap in tuple */
/* Set nullmask presence bit in SpGistLeafTuple header */
SGLT_SET_HASNULLMASK(tup, true);
/* Fill the data area and null mask */
bp = (bits8 *) ((char *) tup + sizeof(SpGistLeafTupleData));
bp = (uint8 *) ((char *) tup + sizeof(SpGistLeafTupleData));
heap_fill_tuple(tupleDescriptor, datums, isnulls, tp, data_size,
&tupmask, bp);
}
@ -942,7 +942,7 @@ spgFormLeafTuple(SpGistState *state, const ItemPointerData *heapPtr,
{
/* Fill data area only */
heap_fill_tuple(tupleDescriptor, datums, isnulls, tp, data_size,
&tupmask, (bits8 *) NULL);
&tupmask, (uint8 *) NULL);
}
/* otherwise we have no data, nor a bitmap, to fill */
@ -1116,7 +1116,7 @@ spgDeformLeafTuple(SpGistLeafTuple tup, TupleDesc tupleDescriptor,
{
bool hasNullsMask = SGLT_GET_HASNULLMASK(tup);
char *tp; /* ptr to tuple data */
bits8 *bp; /* ptr to null bitmap in tuple */
uint8 *bp; /* ptr to null bitmap in tuple */
if (keyColumnIsNull && tupleDescriptor->natts == 1)
{
@ -1137,7 +1137,7 @@ spgDeformLeafTuple(SpGistLeafTuple tup, TupleDesc tupleDescriptor,
}
tp = (char *) tup + SGLTHDRSZ(hasNullsMask);
bp = (bits8 *) ((char *) tup + sizeof(SpGistLeafTupleData));
bp = (uint8 *) ((char *) tup + sizeof(SpGistLeafTupleData));
index_deform_tuple_internal(tupleDescriptor,
datums, isnulls,

View file

@ -740,8 +740,8 @@ index_create(Relation heapRelation,
const int16 *coloptions,
const NullableDatum *stattargets,
Datum reloptions,
bits16 flags,
bits16 constr_flags,
uint16 flags,
uint16 constr_flags,
bool allow_system_table_mods,
bool is_internal,
Oid *constraintId)
@ -1889,7 +1889,7 @@ index_constraint_create(Relation heapRelation,
const IndexInfo *indexInfo,
const char *constraintName,
char constraintType,
bits16 constr_flags,
uint16 constr_flags,
bool allow_system_table_mods,
bool is_internal)
{

View file

@ -201,7 +201,7 @@ CatalogTupleCheckConstraints(Relation heapRel, HeapTuple tup)
if (HeapTupleHasNulls(tup))
{
TupleDesc tupdesc = RelationGetDescr(heapRel);
bits8 *bp = tup->t_data->t_bits;
uint8 *bp = tup->t_data->t_bits;
for (int attnum = 0; attnum < tupdesc->natts; attnum++)
{

View file

@ -3039,7 +3039,7 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
case ProcedureRelationId:
{
bits16 flags = FORMAT_PROC_INVALID_AS_NULL;
uint16 flags = FORMAT_PROC_INVALID_AS_NULL;
char *proname = format_procedure_extended(object->objectId,
flags);
@ -3052,7 +3052,7 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
case TypeRelationId:
{
bits16 flags = FORMAT_TYPE_INVALID_AS_NULL;
uint16 flags = FORMAT_TYPE_INVALID_AS_NULL;
char *typname = format_type_extended(object->objectId, -1,
flags);
@ -3245,7 +3245,7 @@ getObjectDescription(const ObjectAddress *object, bool missing_ok)
case OperatorRelationId:
{
bits16 flags = FORMAT_OPERATOR_INVALID_AS_NULL;
uint16 flags = FORMAT_OPERATOR_INVALID_AS_NULL;
char *oprname = format_operator_extended(object->objectId,
flags);
@ -5160,7 +5160,7 @@ getObjectIdentityParts(const ObjectAddress *object,
case ProcedureRelationId:
{
bits16 flags = FORMAT_PROC_FORCE_QUALIFY | FORMAT_PROC_INVALID_AS_NULL;
uint16 flags = FORMAT_PROC_FORCE_QUALIFY | FORMAT_PROC_INVALID_AS_NULL;
char *proname = format_procedure_extended(object->objectId,
flags);
@ -5176,7 +5176,7 @@ getObjectIdentityParts(const ObjectAddress *object,
case TypeRelationId:
{
bits16 flags = FORMAT_TYPE_INVALID_AS_NULL | FORMAT_TYPE_FORCE_QUALIFY;
uint16 flags = FORMAT_TYPE_INVALID_AS_NULL | FORMAT_TYPE_FORCE_QUALIFY;
char *typeout;
typeout = format_type_extended(object->objectId, -1, flags);
@ -5383,7 +5383,7 @@ getObjectIdentityParts(const ObjectAddress *object,
case OperatorRelationId:
{
bits16 flags = FORMAT_OPERATOR_FORCE_QUALIFY | FORMAT_OPERATOR_INVALID_AS_NULL;
uint16 flags = FORMAT_OPERATOR_FORCE_QUALIFY | FORMAT_OPERATOR_INVALID_AS_NULL;
char *oprname = format_operator_extended(object->objectId,
flags);

View file

@ -581,8 +581,8 @@ DefineIndex(ParseState *pstate,
Datum reloptions;
int16 *coloptions;
IndexInfo *indexInfo;
bits16 flags;
bits16 constr_flags;
uint16 flags;
uint16 constr_flags;
int numberOfAttributes;
int numberOfKeyAttributes;
TransactionId limitXmin;

View file

@ -89,7 +89,7 @@
*/
typedef struct SubOpts
{
bits32 specified_opts;
uint32 specified_opts;
char *slot_name;
char *synchronous_commit;
bool connect;
@ -150,7 +150,7 @@ static void CheckAlterSubOption(Subscription *sub, const char *option,
*/
static void
parse_subscription_options(ParseState *pstate, List *stmt_options,
bits32 supported_opts, SubOpts *opts)
uint32 supported_opts, SubOpts *opts)
{
ListCell *lc;
@ -626,7 +626,7 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
char *conninfo;
char originname[NAMEDATALEN];
List *publications;
bits32 supported_opts;
uint32 supported_opts;
SubOpts opts = {0};
AclResult aclresult;
@ -1430,7 +1430,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
char *origin;
Subscription *sub;
Form_pg_subscription form;
bits32 supported_opts;
uint32 supported_opts;
SubOpts opts = {0};
rel = table_open(SubscriptionRelationId, RowExclusiveLock);

View file

@ -9787,7 +9787,7 @@ ATExecAddIndexConstraint(AlteredTableInfo *tab, Relation rel,
char *constraintName;
char constraintType;
ObjectAddress address;
bits16 flags;
uint16 flags;
Assert(IsA(stmt, IndexStmt));
Assert(OidIsValid(index_oid));

View file

@ -717,7 +717,7 @@ vacuum(List *relations, const VacuumParams params, BufferAccessStrategy bstrateg
*/
bool
vacuum_is_permitted_for_relation(Oid relid, Form_pg_class reltuple,
bits32 options)
uint32 options)
{
char *relname;
@ -768,7 +768,7 @@ vacuum_is_permitted_for_relation(Oid relid, Form_pg_class reltuple,
* or locked, a log is emitted if possible.
*/
Relation
vacuum_open_relation(Oid relid, RangeVar *relation, bits32 options,
vacuum_open_relation(Oid relid, RangeVar *relation, uint32 options,
bool verbose, LOCKMODE lmode)
{
Relation rel;

View file

@ -3442,7 +3442,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
bool havenulls = false;
bool haveempty = false;
char **subdata;
bits8 **subbitmaps;
uint8 **subbitmaps;
int *subbytes;
int *subnitems;
int32 dataoffset;
@ -3450,7 +3450,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op)
int iitem;
subdata = (char **) palloc(nelems * sizeof(char *));
subbitmaps = (bits8 **) palloc(nelems * sizeof(bits8 *));
subbitmaps = (uint8 **) palloc(nelems * sizeof(uint8 *));
subbytes = (int *) palloc(nelems * sizeof(int));
subnitems = (int *) palloc(nelems * sizeof(int));
@ -4036,7 +4036,7 @@ ExecEvalScalarArrayOp(ExprState *state, ExprEvalStep *op)
char typalign;
uint8 typalignby;
char *s;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
/*
@ -4263,7 +4263,7 @@ ExecEvalHashedScalarArrayOp(ExprState *state, ExprEvalStep *op, ExprContext *eco
int nitems;
bool has_nulls = false;
char *s;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
MemoryContext oldcontext;
ArrayType *arr;

View file

@ -309,7 +309,7 @@ ExecCloseIndices(ResultRelInfo *resultRelInfo)
List *
ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
EState *estate,
bits32 flags,
uint32 flags,
TupleTableSlot *slot,
List *arbiterIndexes,
bool *specConflict)

View file

@ -851,7 +851,7 @@ ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo,
if (resultRelInfo->ri_NumIndices > 0)
{
bits32 flags;
uint32 flags;
if (conflictindexes != NIL)
flags = EIIT_NO_DUPE_ERROR;
@ -955,7 +955,7 @@ ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo,
if (resultRelInfo->ri_NumIndices > 0 && (update_indexes != TU_None))
{
bits32 flags = EIIT_IS_UPDATE;
uint32 flags = EIIT_IS_UPDATE;
if (conflictindexes != NIL)
flags |= EIIT_NO_DUPE_ERROR;

View file

@ -1059,7 +1059,7 @@ slot_deform_heap_tuple(TupleTableSlot *slot, HeapTuple tuple, uint32 *offp,
natts = Min(natts, reqnatts);
if (natts > firstNonGuaranteedAttr)
{
bits8 *bp = tup->t_bits;
uint8 *bp = tup->t_bits;
/* Find the first NULL attr */
firstNullAttr = first_null_attr(bp, natts);

View file

@ -2357,7 +2357,7 @@ ExecUpdateEpilogue(ModifyTableContext *context, UpdateContext *updateCxt,
/* insert index entries for tuple if necessary */
if (resultRelInfo->ri_NumIndices > 0 && (updateCxt->updateIndexes != TU_None))
{
bits32 flags = EIIT_IS_UPDATE;
uint32 flags = EIIT_IS_UPDATE;
if (updateCxt->updateIndexes == TU_Summarizing)
flags |= EIIT_ONLY_SUMMARIZING;

View file

@ -48,7 +48,7 @@ GetForeignDataWrapper(Oid fdwid)
* be found instead of raising an error.
*/
ForeignDataWrapper *
GetForeignDataWrapperExtended(Oid fdwid, bits16 flags)
GetForeignDataWrapperExtended(Oid fdwid, uint16 flags)
{
Form_pg_foreign_data_wrapper fdwform;
ForeignDataWrapper *fdw;
@ -123,7 +123,7 @@ GetForeignServer(Oid serverid)
* instead of raising an error.
*/
ForeignServer *
GetForeignServerExtended(Oid serverid, bits16 flags)
GetForeignServerExtended(Oid serverid, uint16 flags)
{
Form_pg_foreign_server serverform;
ForeignServer *server;

View file

@ -135,7 +135,7 @@ my @nodetag_only;
# types that are copied by straight assignment
my @scalar_types = qw(
bits32 bool char double int int8 int16 int32 int64 long uint8 uint16 uint32 uint64
bool char double int int8 int16 int32 int64 long uint8 uint16 uint32 uint64
AclMode AttrNumber Cardinality Cost Index Oid RelFileNumber Selectivity Size StrategyNumber SubTransactionId TimeLineID XLogRecPtr
);
@ -1031,7 +1031,6 @@ _read${n}(void)
print $rff "\tREAD_INT_FIELD($f);\n" unless $no_read;
}
elsif ($t eq 'uint32'
|| $t eq 'bits32'
|| $t eq 'BlockNumber'
|| $t eq 'Index'
|| $t eq 'SubTransactionId')

View file

@ -861,7 +861,7 @@ void
BackgroundWorkerInitializeConnection(const char *dbname, const char *username, uint32 flags)
{
BackgroundWorker *worker = MyBgworkerEntry;
bits32 init_flags = 0; /* never honor session_preload_libraries */
uint32 init_flags = 0; /* never honor session_preload_libraries */
/* ignore datallowconn and ACL_CONNECT? */
if (flags & BGWORKER_BYPASS_ALLOWCONN)
@ -895,7 +895,7 @@ void
BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid, uint32 flags)
{
BackgroundWorker *worker = MyBgworkerEntry;
bits32 init_flags = 0; /* never honor session_preload_libraries */
uint32 init_flags = 0; /* never honor session_preload_libraries */
/* ignore datallowconn and ACL_CONNECT? */
if (flags & BGWORKER_BYPASS_ALLOWCONN)

View file

@ -887,7 +887,7 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
{
PipeProtoHeader p;
int chunklen;
bits8 dest_flags;
uint8 dest_flags;
/* Do we have a valid header? */
memcpy(&p, cursor, offsetof(PipeProtoHeader, data));

View file

@ -268,7 +268,7 @@ pgstat_flush_backend_entry_wal(PgStat_EntryRef *entry_ref)
* if some statistics could not be flushed due to lock contention.
*/
bool
pgstat_flush_backend(bool nowait, bits32 flags)
pgstat_flush_backend(bool nowait, uint32 flags)
{
PgStat_EntryRef *entry_ref;
bool has_pending_data = false;

View file

@ -337,7 +337,7 @@ array_cat(PG_FUNCTION_ARGS)
int i;
char *dat1,
*dat2;
bits8 *bitmap1,
uint8 *bitmap1,
*bitmap2;
Oid element_type;
Oid element_type1;
@ -1013,7 +1013,7 @@ array_agg_array_combine(PG_FUNCTION_ARGS)
{
int size = (state2->aitems + 7) / 8;
state1->nullbitmap = (bits8 *) palloc(size);
state1->nullbitmap = (uint8 *) palloc(size);
memcpy(state1->nullbitmap, state2->nullbitmap, size);
}
@ -1084,7 +1084,7 @@ array_agg_array_combine(PG_FUNCTION_ARGS)
* previous inputs by marking all their items non-null.
*/
state1->aitems = pg_nextpower2_32(Max(256, newnitems + 1));
state1->nullbitmap = (bits8 *) palloc((state1->aitems + 7) / 8);
state1->nullbitmap = (uint8 *) palloc((state1->aitems + 7) / 8);
array_bitmap_copy(state1->nullbitmap, 0,
NULL, 0,
state1->nitems);
@ -1094,7 +1094,7 @@ array_agg_array_combine(PG_FUNCTION_ARGS)
int newaitems = state1->aitems + state2->aitems;
state1->aitems = pg_nextpower2_32(newaitems);
state1->nullbitmap = (bits8 *)
state1->nullbitmap = (uint8 *)
repalloc(state1->nullbitmap, (state1->aitems + 7) / 8);
}
array_bitmap_copy(state1->nullbitmap, state1->nitems,
@ -1238,7 +1238,7 @@ array_agg_array_deserialize(PG_FUNCTION_ARGS)
{
int size = (result->aitems + 7) / 8;
result->nullbitmap = (bits8 *) palloc(size);
result->nullbitmap = (uint8 *) palloc(size);
temp = pq_getmsgbytes(&buf, size);
memcpy(result->nullbitmap, temp, size);
}

View file

@ -70,7 +70,7 @@ typedef struct ArrayIteratorData
{
/* basic info about the array, set up during array_create_iterator() */
ArrayType *arr; /* array we're iterating through */
bits8 *nullbitmap; /* its null bitmap, if any */
uint8 *nullbitmap; /* its null bitmap, if any */
int nitems; /* total number of elements in array */
int16 typlen; /* element type's length */
bool typbyval; /* element type's byval property */
@ -120,26 +120,26 @@ static Datum array_set_element_expanded(Datum arraydatum,
Datum dataValue, bool isNull,
int arraytyplen,
int elmlen, bool elmbyval, char elmalign);
static bool array_get_isnull(const bits8 *nullbitmap, int offset);
static void array_set_isnull(bits8 *nullbitmap, int offset, bool isNull);
static bool array_get_isnull(const uint8 *nullbitmap, int offset);
static void array_set_isnull(uint8 *nullbitmap, int offset, bool isNull);
static Datum ArrayCast(char *value, bool byval, int len);
static int ArrayCastAndSet(Datum src,
int typlen, bool typbyval, uint8 typalignby,
char *dest);
static char *array_seek(char *ptr, int offset, bits8 *nullbitmap, int nitems,
static char *array_seek(char *ptr, int offset, uint8 *nullbitmap, int nitems,
int typlen, bool typbyval, char typalign);
static int array_nelems_size(char *ptr, int offset, bits8 *nullbitmap,
static int array_nelems_size(char *ptr, int offset, uint8 *nullbitmap,
int nitems, int typlen, bool typbyval, char typalign);
static int array_copy(char *destptr, int nitems,
char *srcptr, int offset, bits8 *nullbitmap,
char *srcptr, int offset, uint8 *nullbitmap,
int typlen, bool typbyval, char typalign);
static int array_slice_size(char *arraydataptr, bits8 *arraynullsptr,
static int array_slice_size(char *arraydataptr, uint8 *arraynullsptr,
int ndim, int *dim, int *lb,
int *st, int *endp,
int typlen, bool typbyval, char typalign);
static void array_extract_slice(ArrayType *newarray,
int ndim, int *dim, int *lb,
char *arraydataptr, bits8 *arraynullsptr,
char *arraydataptr, uint8 *arraynullsptr,
int *st, int *endp,
int typlen, bool typbyval, char typalign);
static void array_insert_slice(ArrayType *destArray, ArrayType *origArray,
@ -972,7 +972,7 @@ CopyArrayEls(ArrayType *array,
bool freedata)
{
char *p = ARR_DATA_PTR(array);
bits8 *bitmap = ARR_NULLBITMAP(array);
uint8 *bitmap = ARR_NULLBITMAP(array);
int bitval = 0;
int bitmask = 1;
uint8 typalignby = typalign_to_alignby(typalign);
@ -1839,7 +1839,7 @@ array_get_element(Datum arraydatum,
fixedLb[1];
char *arraydataptr,
*retptr;
bits8 *arraynullsptr;
uint8 *arraynullsptr;
if (arraytyplen > 0)
{
@ -2053,7 +2053,7 @@ array_get_slice(Datum arraydatum,
fixedLb[1];
Oid elemtype;
char *arraydataptr;
bits8 *arraynullsptr;
uint8 *arraynullsptr;
int32 dataoffset;
int bytes,
span[MAXDIM];
@ -2221,7 +2221,7 @@ array_set_element(Datum arraydatum,
offset;
char *elt_ptr;
bool newhasnulls;
bits8 *oldnullbitmap;
uint8 *oldnullbitmap;
int oldnitems,
newnitems,
olddatasize,
@ -2467,7 +2467,7 @@ array_set_element(Datum arraydatum,
*/
if (newhasnulls)
{
bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
uint8 *newnullbitmap = ARR_NULLBITMAP(newarray);
/* palloc0 above already marked any inserted positions as nulls */
/* Fix the inserted value */
@ -3059,7 +3059,7 @@ array_set_slice(Datum arraydatum,
int slicelb = Max(oldlb, lowerIndx[0]);
int sliceub = Min(oldub, upperIndx[0]);
char *oldarraydata = ARR_DATA_PTR(array);
bits8 *oldarraybitmap = ARR_NULLBITMAP(array);
uint8 *oldarraybitmap = ARR_NULLBITMAP(array);
/* count/size of old array entries that will go before the slice */
itemsbefore = Min(slicelb, oldub + 1) - oldlb;
@ -3121,8 +3121,8 @@ array_set_slice(Datum arraydatum,
/* fill in nulls bitmap if needed */
if (newhasnulls)
{
bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
bits8 *oldnullbitmap = ARR_NULLBITMAP(array);
uint8 *newnullbitmap = ARR_NULLBITMAP(newarray);
uint8 *oldnullbitmap = ARR_NULLBITMAP(array);
/* palloc0 above already marked any inserted positions as nulls */
array_bitmap_copy(newnullbitmap, addedbefore,
@ -3644,7 +3644,7 @@ deconstruct_array(const ArrayType *array,
bool *nulls;
int nelems;
char *p;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
int i;
uint8 elmalignby = typalign_to_alignby(elmalign);
@ -3781,7 +3781,7 @@ bool
array_contains_nulls(const ArrayType *array)
{
int nelems;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
/* Easy answer if there's no null bitmap */
@ -4791,7 +4791,7 @@ array_free_iterator(ArrayIterator iterator)
* offset: 0-based linear element number of array element
*/
static bool
array_get_isnull(const bits8 *nullbitmap, int offset)
array_get_isnull(const uint8 *nullbitmap, int offset)
{
if (nullbitmap == NULL)
return false; /* assume not null */
@ -4808,7 +4808,7 @@ array_get_isnull(const bits8 *nullbitmap, int offset)
* isNull: null status to set
*/
static void
array_set_isnull(bits8 *nullbitmap, int offset, bool isNull)
array_set_isnull(uint8 *nullbitmap, int offset, bool isNull)
{
int bitmask;
@ -4876,7 +4876,7 @@ ArrayCastAndSet(Datum src,
* It is caller's responsibility to ensure that nitems is within range
*/
static char *
array_seek(char *ptr, int offset, bits8 *nullbitmap, int nitems,
array_seek(char *ptr, int offset, uint8 *nullbitmap, int nitems,
int typlen, bool typbyval, char typalign)
{
uint8 typalignby = typalign_to_alignby(typalign);
@ -4925,7 +4925,7 @@ array_seek(char *ptr, int offset, bits8 *nullbitmap, int nitems,
* Parameters same as for array_seek
*/
static int
array_nelems_size(char *ptr, int offset, bits8 *nullbitmap, int nitems,
array_nelems_size(char *ptr, int offset, uint8 *nullbitmap, int nitems,
int typlen, bool typbyval, char typalign)
{
return array_seek(ptr, offset, nullbitmap, nitems,
@ -4948,7 +4948,7 @@ array_nelems_size(char *ptr, int offset, bits8 *nullbitmap, int nitems,
*/
static int
array_copy(char *destptr, int nitems,
char *srcptr, int offset, bits8 *nullbitmap,
char *srcptr, int offset, uint8 *nullbitmap,
int typlen, bool typbyval, char typalign)
{
int numbytes;
@ -4977,8 +4977,8 @@ array_copy(char *destptr, int nitems,
* to make it worth worrying too much. For the moment, KISS.
*/
void
array_bitmap_copy(bits8 *destbitmap, int destoffset,
const bits8 *srcbitmap, int srcoffset,
array_bitmap_copy(uint8 *destbitmap, int destoffset,
const uint8 *srcbitmap, int srcoffset,
int nitems)
{
int destbitmask,
@ -5048,7 +5048,7 @@ array_bitmap_copy(bits8 *destbitmap, int destoffset,
* We assume the caller has verified that the slice coordinates are valid.
*/
static int
array_slice_size(char *arraydataptr, bits8 *arraynullsptr,
array_slice_size(char *arraydataptr, uint8 *arraynullsptr,
int ndim, int *dim, int *lb,
int *st, int *endp,
int typlen, bool typbyval, char typalign)
@ -5114,7 +5114,7 @@ array_extract_slice(ArrayType *newarray,
int *dim,
int *lb,
char *arraydataptr,
bits8 *arraynullsptr,
uint8 *arraynullsptr,
int *st,
int *endp,
int typlen,
@ -5122,7 +5122,7 @@ array_extract_slice(ArrayType *newarray,
char typalign)
{
char *destdataptr = ARR_DATA_PTR(newarray);
bits8 *destnullsptr = ARR_NULLBITMAP(newarray);
uint8 *destnullsptr = ARR_NULLBITMAP(newarray);
char *srcdataptr;
int src_offset,
dest_offset,
@ -5197,9 +5197,9 @@ array_insert_slice(ArrayType *destArray,
char *destPtr = ARR_DATA_PTR(destArray);
char *origPtr = ARR_DATA_PTR(origArray);
char *srcPtr = ARR_DATA_PTR(srcArray);
bits8 *destBitmap = ARR_NULLBITMAP(destArray);
bits8 *origBitmap = ARR_NULLBITMAP(origArray);
bits8 *srcBitmap = ARR_NULLBITMAP(srcArray);
uint8 *destBitmap = ARR_NULLBITMAP(destArray);
uint8 *origBitmap = ARR_NULLBITMAP(origArray);
uint8 *srcBitmap = ARR_NULLBITMAP(srcArray);
int orignitems = ArrayGetNItems(ARR_NDIM(origArray),
ARR_DIMS(origArray));
int dest_offset,
@ -5679,7 +5679,7 @@ accumArrayResultArr(ArrayBuildStateArr *astate,
* previous inputs by marking all their items non-null.
*/
astate->aitems = pg_nextpower2_32(Max(256, newnitems + 1));
astate->nullbitmap = (bits8 *) palloc((astate->aitems + 7) / 8);
astate->nullbitmap = (uint8 *) palloc((astate->aitems + 7) / 8);
array_bitmap_copy(astate->nullbitmap, 0,
NULL, 0,
astate->nitems);
@ -5687,7 +5687,7 @@ accumArrayResultArr(ArrayBuildStateArr *astate,
else if (newnitems > astate->aitems)
{
astate->aitems = Max(astate->aitems * 2, newnitems);
astate->nullbitmap = (bits8 *)
astate->nullbitmap = (uint8 *)
repalloc(astate->nullbitmap, (astate->aitems + 7) / 8);
}
array_bitmap_copy(astate->nullbitmap, astate->nitems,
@ -6419,7 +6419,7 @@ array_replace_internal(ArrayType *array,
char typalign;
uint8 typalignby;
char *arraydataptr;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
bool changed = false;
TypeCacheEntry *typentry;

View file

@ -62,7 +62,7 @@ format_type(PG_FUNCTION_ARGS)
Oid type_oid;
int32 typemod;
char *result;
bits16 flags = FORMAT_TYPE_ALLOW_INVALID;
uint16 flags = FORMAT_TYPE_ALLOW_INVALID;
/* Since this function is not strict, we must test for null args */
if (PG_ARGISNULL(0))
@ -109,7 +109,7 @@ format_type(PG_FUNCTION_ARGS)
* Returns a palloc'd string, or NULL.
*/
char *
format_type_extended(Oid type_oid, int32 typemod, bits16 flags)
format_type_extended(Oid type_oid, int32 typemod, uint16 flags)
{
HeapTuple tuple;
Form_pg_type typeform;

View file

@ -88,7 +88,7 @@ count_nulls(FunctionCallInfo fcinfo,
int ndims,
nitems,
*dims;
bits8 *bitmap;
uint8 *bitmap;
Assert(PG_NARGS() == 1);

View file

@ -329,7 +329,7 @@ format_procedure_qualified(Oid procedure_oid)
* always schema-qualify procedure names, regardless of search_path
*/
char *
format_procedure_extended(Oid procedure_oid, bits16 flags)
format_procedure_extended(Oid procedure_oid, uint16 flags)
{
char *result;
HeapTuple proctup;
@ -727,7 +727,7 @@ to_regoperator(PG_FUNCTION_ARGS)
* always schema-qualify operator names, regardless of search_path
*/
char *
format_operator_extended(Oid operator_oid, bits16 flags)
format_operator_extended(Oid operator_oid, uint16 flags)
{
char *result;
HeapTuple opertup;

View file

@ -1255,7 +1255,7 @@ pg_get_indexdef_columns(Oid indexrelid, bool pretty)
/* Internal version, extensible with flags to control its behavior */
char *
pg_get_indexdef_columns_extended(Oid indexrelid, bits16 flags)
pg_get_indexdef_columns_extended(Oid indexrelid, uint16 flags)
{
bool pretty = ((flags & RULE_INDEXDEF_PRETTY) != 0);
bool keys_only = ((flags & RULE_INDEXDEF_KEYS_ONLY) != 0);

View file

@ -154,13 +154,13 @@ bit_in(PG_FUNCTION_ARGS)
Node *escontext = fcinfo->context;
VarBit *result; /* The resulting bit string */
char *sp; /* pointer into the character string */
bits8 *r; /* pointer into the result */
uint8 *r; /* pointer into the result */
int len, /* Length of the whole data structure */
bitlen, /* Number of bits in the bit string */
slen; /* Length of the input string */
bool bit_not_hex; /* false = hex string true = bit string */
int bc;
bits8 x = 0;
uint8 x = 0;
/* Check that the first character is a b or an x */
if (input_string[0] == 'b' || input_string[0] == 'B')
@ -248,11 +248,11 @@ bit_in(PG_FUNCTION_ARGS)
for (bc = 0; *sp; sp++)
{
if (*sp >= '0' && *sp <= '9')
x = (bits8) (*sp - '0');
x = (uint8) (*sp - '0');
else if (*sp >= 'A' && *sp <= 'F')
x = (bits8) (*sp - 'A') + 10;
x = (uint8) (*sp - 'A') + 10;
else if (*sp >= 'a' && *sp <= 'f')
x = (bits8) (*sp - 'a') + 10;
x = (uint8) (*sp - 'a') + 10;
else
ereturn(escontext, (Datum) 0,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -291,7 +291,7 @@ bit_out(PG_FUNCTION_ARGS)
VarBit *s = PG_GETARG_VARBIT_P(0);
char *result,
*r;
bits8 *sp;
uint8 *sp;
int i,
len,
bitlen;
@ -459,13 +459,13 @@ varbit_in(PG_FUNCTION_ARGS)
Node *escontext = fcinfo->context;
VarBit *result; /* The resulting bit string */
char *sp; /* pointer into the character string */
bits8 *r; /* pointer into the result */
uint8 *r; /* pointer into the result */
int len, /* Length of the whole data structure */
bitlen, /* Number of bits in the bit string */
slen; /* Length of the input string */
bool bit_not_hex; /* false = hex string true = bit string */
int bc;
bits8 x = 0;
uint8 x = 0;
/* Check that the first character is a b or an x */
if (input_string[0] == 'b' || input_string[0] == 'B')
@ -549,11 +549,11 @@ varbit_in(PG_FUNCTION_ARGS)
for (bc = 0; *sp; sp++)
{
if (*sp >= '0' && *sp <= '9')
x = (bits8) (*sp - '0');
x = (uint8) (*sp - '0');
else if (*sp >= 'A' && *sp <= 'F')
x = (bits8) (*sp - 'A') + 10;
x = (uint8) (*sp - 'A') + 10;
else if (*sp >= 'a' && *sp <= 'f')
x = (bits8) (*sp - 'a') + 10;
x = (uint8) (*sp - 'a') + 10;
else
ereturn(escontext, (Datum) 0,
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
@ -589,8 +589,8 @@ varbit_out(PG_FUNCTION_ARGS)
VarBit *s = PG_GETARG_VARBIT_P(0);
char *result,
*r;
bits8 *sp;
bits8 x;
uint8 *sp;
uint8 x;
int i,
k,
len;
@ -982,7 +982,7 @@ bit_catenate(VarBit *arg1, VarBit *arg2)
bytelen,
bit1pad,
bit2shift;
bits8 *pr,
uint8 *pr,
*pa;
bitlen1 = VARBITLEN(arg1);
@ -1063,7 +1063,7 @@ bitsubstring(VarBit *arg, int32 s, int32 l, bool length_not_specified)
int32 e,
s1,
e1;
bits8 *r,
uint8 *r,
*ps;
bitlen = VARBITLEN(arg);
@ -1249,7 +1249,7 @@ bit_and(PG_FUNCTION_ARGS)
bitlen1,
bitlen2,
i;
bits8 *p1,
uint8 *p1,
*p2,
*r;
@ -1290,7 +1290,7 @@ bit_or(PG_FUNCTION_ARGS)
bitlen1,
bitlen2,
i;
bits8 *p1,
uint8 *p1,
*p2,
*r;
@ -1330,7 +1330,7 @@ bitxor(PG_FUNCTION_ARGS)
bitlen1,
bitlen2,
i;
bits8 *p1,
uint8 *p1,
*p2,
*r;
@ -1366,7 +1366,7 @@ bitnot(PG_FUNCTION_ARGS)
{
VarBit *arg = PG_GETARG_VARBIT_P(0);
VarBit *result;
bits8 *p,
uint8 *p,
*r;
result = (VarBit *) palloc(VARSIZE(arg));
@ -1397,7 +1397,7 @@ bitshiftleft(PG_FUNCTION_ARGS)
int byte_shift,
ishift,
len;
bits8 *p,
uint8 *p,
*r;
/* Negative shift is a shift to the right */
@ -1464,7 +1464,7 @@ bitshiftright(PG_FUNCTION_ARGS)
int byte_shift,
ishift,
len;
bits8 *p,
uint8 *p,
*r;
/* Negative shift is a shift to the left */
@ -1533,7 +1533,7 @@ bitfromint4(PG_FUNCTION_ARGS)
int32 a = PG_GETARG_INT32(0);
int32 typmod = PG_GETARG_INT32(1);
VarBit *result;
bits8 *r;
uint8 *r;
int rlen;
int destbitsleft,
srcbitsleft;
@ -1554,7 +1554,7 @@ bitfromint4(PG_FUNCTION_ARGS)
/* sign-fill any excess bytes in output */
while (destbitsleft >= srcbitsleft + 8)
{
*r++ = (bits8) ((a < 0) ? BITMASK : 0);
*r++ = (uint8) ((a < 0) ? BITMASK : 0);
destbitsleft -= 8;
}
/* store first fractional byte */
@ -1565,19 +1565,19 @@ bitfromint4(PG_FUNCTION_ARGS)
/* Force sign-fill in case the compiler implements >> as zero-fill */
if (a < 0)
val |= ((unsigned int) -1) << (srcbitsleft + 8 - destbitsleft);
*r++ = (bits8) (val & BITMASK);
*r++ = (uint8) (val & BITMASK);
destbitsleft -= 8;
}
/* Now srcbitsleft and destbitsleft are the same, need not track both */
/* store whole bytes */
while (destbitsleft >= 8)
{
*r++ = (bits8) ((a >> (destbitsleft - 8)) & BITMASK);
*r++ = (uint8) ((a >> (destbitsleft - 8)) & BITMASK);
destbitsleft -= 8;
}
/* store last fractional byte */
if (destbitsleft > 0)
*r = (bits8) ((a << (8 - destbitsleft)) & BITMASK);
*r = (uint8) ((a << (8 - destbitsleft)) & BITMASK);
PG_RETURN_VARBIT_P(result);
}
@ -1587,7 +1587,7 @@ bittoint4(PG_FUNCTION_ARGS)
{
VarBit *arg = PG_GETARG_VARBIT_P(0);
uint32 result;
bits8 *r;
uint8 *r;
/* Check that the bit string is not too long */
if (VARBITLEN(arg) > sizeof(result) * BITS_PER_BYTE)
@ -1613,7 +1613,7 @@ bitfromint8(PG_FUNCTION_ARGS)
int64 a = PG_GETARG_INT64(0);
int32 typmod = PG_GETARG_INT32(1);
VarBit *result;
bits8 *r;
uint8 *r;
int rlen;
int destbitsleft,
srcbitsleft;
@ -1634,7 +1634,7 @@ bitfromint8(PG_FUNCTION_ARGS)
/* sign-fill any excess bytes in output */
while (destbitsleft >= srcbitsleft + 8)
{
*r++ = (bits8) ((a < 0) ? BITMASK : 0);
*r++ = (uint8) ((a < 0) ? BITMASK : 0);
destbitsleft -= 8;
}
/* store first fractional byte */
@ -1645,19 +1645,19 @@ bitfromint8(PG_FUNCTION_ARGS)
/* Force sign-fill in case the compiler implements >> as zero-fill */
if (a < 0)
val |= ((unsigned int) -1) << (srcbitsleft + 8 - destbitsleft);
*r++ = (bits8) (val & BITMASK);
*r++ = (uint8) (val & BITMASK);
destbitsleft -= 8;
}
/* Now srcbitsleft and destbitsleft are the same, need not track both */
/* store whole bytes */
while (destbitsleft >= 8)
{
*r++ = (bits8) ((a >> (destbitsleft - 8)) & BITMASK);
*r++ = (uint8) ((a >> (destbitsleft - 8)) & BITMASK);
destbitsleft -= 8;
}
/* store last fractional byte */
if (destbitsleft > 0)
*r = (bits8) ((a << (8 - destbitsleft)) & BITMASK);
*r = (uint8) ((a << (8 - destbitsleft)) & BITMASK);
PG_RETURN_VARBIT_P(result);
}
@ -1667,7 +1667,7 @@ bittoint8(PG_FUNCTION_ARGS)
{
VarBit *arg = PG_GETARG_VARBIT_P(0);
uint64 result;
bits8 *r;
uint8 *r;
/* Check that the bit string is not too long */
if (VARBITLEN(arg) > sizeof(result) * BITS_PER_BYTE)
@ -1703,9 +1703,9 @@ bitposition(PG_FUNCTION_ARGS)
str_length,
i,
is;
bits8 *s, /* pointer into substring */
uint8 *s, /* pointer into substring */
*p; /* pointer into str */
bits8 cmp, /* shifted substring byte to compare */
uint8 cmp, /* shifted substring byte to compare */
mask1, /* mask for substring byte shifted right */
mask2, /* mask for substring byte shifted left */
end_mask, /* pad mask for last substring byte */
@ -1812,7 +1812,7 @@ bitsetbit(PG_FUNCTION_ARGS)
VarBit *result;
int len,
bitlen;
bits8 *r,
uint8 *r,
*p;
int byteNo,
bitNo;
@ -1871,7 +1871,7 @@ bitgetbit(PG_FUNCTION_ARGS)
VarBit *arg1 = PG_GETARG_VARBIT_P(0);
int32 n = PG_GETARG_INT32(1);
int bitlen;
bits8 *p;
uint8 *p;
int byteNo,
bitNo;

View file

@ -3952,7 +3952,7 @@ array_to_text_internal(FunctionCallInfo fcinfo, ArrayType *v,
StringInfoData buf;
bool printed = false;
char *p;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
int i;
ArrayMetaState *my_extra;

View file

@ -73,7 +73,7 @@ static TypeFuncClass get_type_func_class(Oid typid, Oid *base_typeid);
* RECORD datatype.
*/
void
InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
InitMaterializedSRF(FunctionCallInfo fcinfo, uint32 flags)
{
bool random_access;
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;

View file

@ -718,7 +718,7 @@ BaseInit(void)
void
InitPostgres(const char *in_dbname, Oid dboid,
const char *username, Oid useroid,
bits32 flags,
uint32 flags,
char *out_dbname)
{
bool bootstrap = IsBootstrapProcessingMode();

View file

@ -94,7 +94,7 @@ struct LogicalRepInfos
{
struct LogicalRepInfo *dbinfo;
bool two_phase; /* enable-two-phase option */
bits32 objecttypes_to_clean; /* flags indicating which object types
uint32 objecttypes_to_clean; /* flags indicating which object types
* to clean up on subscriber */
};

View file

@ -1296,7 +1296,7 @@ typedef struct
const VersionedQuery *vquery; /* versioned query, or NULL */
const SchemaQuery *squery; /* schema query, or NULL */
const char *const *keywords; /* keywords to be offered as well */
const bits32 flags; /* visibility flags, see below */
const uint32 flags; /* visibility flags, see below */
} pgsql_thing_t;
#define THING_NO_CREATE (1 << 0) /* should not show up after CREATE */
@ -5839,7 +5839,7 @@ match_previous_words(int pattern_id,
* Entries that have 'excluded' flags are not returned.
*/
static char *
create_or_drop_command_generator(const char *text, int state, bits32 excluded)
create_or_drop_command_generator(const char *text, int state, uint32 excluded)
{
static int list_index,
string_length;

View file

@ -20,7 +20,7 @@
#include "vacuuming.h"
static void help(const char *progname);
static void check_objfilter(bits32 objfilter);
static void check_objfilter(uint32 objfilter);
int
@ -322,7 +322,7 @@ main(int argc, char *argv[])
* Verify that the filters used at command line are compatible.
*/
void
check_objfilter(bits32 objfilter)
check_objfilter(uint32 objfilter)
{
if ((objfilter & OBJFILTER_ALL_DBS) &&
(objfilter & OBJFILTER_DATABASE))

View file

@ -32,7 +32,7 @@ typedef enum
typedef struct vacuumingOptions
{
RunMode mode;
bits32 objfilter;
uint32 objfilter;
bool verbose;
bool and_analyze;
bool full;

View file

@ -175,7 +175,7 @@ struct HeapTupleHeaderData
/* ^ - 23 bytes - ^ */
#define FIELDNO_HEAPTUPLEHEADERDATA_BITS 5
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
uint8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
/* MORE DATA FOLLOWS AT END OF STRUCT */
};
@ -680,7 +680,7 @@ struct MinimalTupleData
/* ^ - 23 bytes - ^ */
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
uint8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
/* MORE DATA FOLLOWS AT END OF STRUCT */
};
@ -797,7 +797,7 @@ extern Size heap_compute_data_size(TupleDesc tupleDesc,
extern void heap_fill_tuple(TupleDesc tupleDesc,
const Datum *values, const bool *isnull,
char *data, Size data_size,
uint16 *infomask, bits8 *bit);
uint16 *infomask, uint8 *bit);
extern bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc);
extern Datum nocachegetattr(HeapTuple tup, int attnum,
TupleDesc tupleDesc);

View file

@ -54,7 +54,7 @@ typedef IndexTupleData *IndexTuple;
typedef struct IndexAttributeBitMapData
{
bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8];
uint8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8];
} IndexAttributeBitMapData;
typedef IndexAttributeBitMapData * IndexAttributeBitMap;
@ -99,7 +99,7 @@ extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
extern void index_deform_tuple_internal(TupleDesc tupleDescriptor,
Datum *values, bool *isnull,
char *tp, bits8 *bp, int hasnulls);
char *tp, uint8 *bp, int hasnulls);
extern IndexTuple CopyIndexTuple(IndexTuple source);
extern IndexTuple index_truncate_tuple(TupleDesc sourceDescriptor,
IndexTuple source, int leavenatts);
@ -151,7 +151,7 @@ index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
}
else
{
if (att_isnull(attnum - 1, (bits8 *) tup + sizeof(IndexTupleData)))
if (att_isnull(attnum - 1, (uint8 *) tup + sizeof(IndexTupleData)))
{
*isnull = true;
return (Datum) 0;

View file

@ -66,7 +66,7 @@ typedef struct relopt_gen
const char *name; /* must be first (used as list termination
* marker) */
const char *desc;
bits32 kinds;
uint32 kinds;
LOCKMODE lockmode;
int namelen;
relopt_type type;
@ -187,20 +187,20 @@ typedef struct local_relopts
(char *)(optstruct) + (optstruct)->member)
extern relopt_kind add_reloption_kind(void);
extern void add_bool_reloption(bits32 kinds, const char *name, const char *desc,
extern void add_bool_reloption(uint32 kinds, const char *name, const char *desc,
bool default_val, LOCKMODE lockmode);
extern void add_ternary_reloption(bits32 kinds, const char *name,
extern void add_ternary_reloption(uint32 kinds, const char *name,
const char *desc, LOCKMODE lockmode);
extern void add_int_reloption(bits32 kinds, const char *name, const char *desc,
extern void add_int_reloption(uint32 kinds, const char *name, const char *desc,
int default_val, int min_val, int max_val,
LOCKMODE lockmode);
extern void add_real_reloption(bits32 kinds, const char *name, const char *desc,
extern void add_real_reloption(uint32 kinds, const char *name, const char *desc,
double default_val, double min_val, double max_val,
LOCKMODE lockmode);
extern void add_enum_reloption(bits32 kinds, const char *name, const char *desc,
extern void add_enum_reloption(uint32 kinds, const char *name, const char *desc,
relopt_enum_elt_def *members, int default_val,
const char *detailmsg, LOCKMODE lockmode);
extern void add_string_reloption(bits32 kinds, const char *name, const char *desc,
extern void add_string_reloption(uint32 kinds, const char *name, const char *desc,
const char *default_val, validate_string_relopt validator,
LOCKMODE lockmode);

View file

@ -25,7 +25,7 @@
* non-null.
*/
static inline bool
att_isnull(int ATT, const bits8 *BITS)
att_isnull(int ATT, const uint8 *BITS)
{
return !(BITS[ATT >> 3] & (1 << (ATT & 0x07)));
}
@ -40,7 +40,7 @@ att_isnull(int ATT, const bits8 *BITS)
* effectively as if natts is rounded up to the next multiple of 8.
*/
static inline void
populate_isnull_array(const bits8 *bits, int natts, bool *isnull)
populate_isnull_array(const uint8 *bits, int natts, bool *isnull)
{
int nbytes = (natts + 7) >> 3;
@ -60,7 +60,7 @@ populate_isnull_array(const bits8 *bits, int natts, bool *isnull)
for (int i = 0; i < nbytes; i++, isnull += 8)
{
uint64 isnull_8;
bits8 nullbyte = ~bits[i];
uint8 nullbyte = ~bits[i];
/* Convert the lower 4 bits of NULL bitmap word into a 64 bit int */
isnull_8 = (nullbyte & 0xf) * SPREAD_BITS_MULTIPLIER_32;
@ -241,7 +241,7 @@ align_fetch_then_add(const char *tupptr, uint32 *off, bool attbyval, int attlen,
* case.
*/
static inline int
first_null_attr(const bits8 *bits, int natts)
first_null_attr(const uint8 *bits, int natts)
{
int nattByte = natts >> 3;
int bytenum;

View file

@ -618,14 +618,6 @@ typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
/*
* bitsN
* Unit of bitwise operation, AT LEAST N BITS IN SIZE.
*/
typedef uint8 bits8; /* >= 8 bits */
typedef uint16 bits16; /* >= 16 bits */
typedef uint32 bits32; /* >= 32 bits */
/*
* 64-bit integers
*/

View file

@ -38,7 +38,7 @@ typedef enum
/* options for REINDEX */
typedef struct ReindexParams
{
bits32 options; /* bitmask of REINDEXOPT_* */
uint32 options; /* bitmask of REINDEXOPT_* */
Oid tablespaceOid; /* New tablespace to move indexes to.
* InvalidOid to do nothing. */
} ReindexParams;
@ -88,8 +88,8 @@ extern Oid index_create(Relation heapRelation,
const int16 *coloptions,
const NullableDatum *stattargets,
Datum reloptions,
bits16 flags,
bits16 constr_flags,
uint16 flags,
uint16 constr_flags,
bool allow_system_table_mods,
bool is_internal,
Oid *constraintId);
@ -122,7 +122,7 @@ extern ObjectAddress index_constraint_create(Relation heapRelation,
const IndexInfo *indexInfo,
const char *constraintName,
char constraintType,
bits16 constr_flags,
uint16 constr_flags,
bool allow_system_table_mods,
bool is_internal);

View file

@ -29,7 +29,7 @@
/* options for CLUSTER */
typedef struct ClusterParams
{
bits32 options; /* bitmask of CLUOPT_* */
uint32 options; /* bitmask of CLUOPT_* */
} ClusterParams;

View file

@ -215,7 +215,7 @@ typedef enum VacOptValue
*/
typedef struct VacuumParams
{
bits32 options; /* bitmask of VACOPT_* */
uint32 options; /* bitmask of VACOPT_* */
int freeze_min_age; /* min freeze age, -1 to use default */
int freeze_table_age; /* age at which to scan whole table */
int multixact_freeze_min_age; /* min multixact freeze age, -1 to
@ -389,9 +389,9 @@ extern bool vacuum_xid_failsafe_check(const struct VacuumCutoffs *cutoffs);
extern void vac_update_datfrozenxid(void);
extern void vacuum_delay_point(bool is_analyze);
extern bool vacuum_is_permitted_for_relation(Oid relid, Form_pg_class reltuple,
bits32 options);
uint32 options);
extern Relation vacuum_open_relation(Oid relid, RangeVar *relation,
bits32 options, bool verbose,
uint32 options, bool verbose,
LOCKMODE lmode);
extern IndexBulkDeleteResult *vac_bulkdel_one_index(IndexVacuumInfo *ivinfo,
IndexBulkDeleteResult *istat,

View file

@ -108,7 +108,7 @@ typedef struct JsonLexContext
bool incremental;
JsonTokenType token_type;
int lex_level;
bits32 flags;
uint32 flags;
int line_number; /* line number, starting from 1 */
const char *line_start; /* where that line starts within input */
JsonParserStack *pstack;

View file

@ -751,7 +751,7 @@ extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
#define EIIT_NO_DUPE_ERROR (1<<1)
#define EIIT_ONLY_SUMMARIZING (1<<2)
extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo, EState *estate,
bits32 options, TupleTableSlot *slot,
uint32 options, TupleTableSlot *slot,
List *arbiterIndexes,
bool *specConflict);
extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo,

View file

@ -192,7 +192,7 @@ typedef struct IncrementalSortGroupInfo
int64 totalDiskSpaceUsed;
int64 maxMemorySpaceUsed;
int64 totalMemorySpaceUsed;
bits32 sortMethods; /* bitmask of TuplesortMethod */
uint32 sortMethods; /* bitmask of TuplesortMethod */
} IncrementalSortGroupInfo;
typedef struct IncrementalSortInfo

View file

@ -67,7 +67,7 @@ typedef struct ForeignTable
extern ForeignServer *GetForeignServer(Oid serverid);
extern ForeignServer *GetForeignServerExtended(Oid serverid,
bits16 flags);
uint16 flags);
extern ForeignServer *GetForeignServerByName(const char *srvname,
bool missing_ok);
extern char *ForeignServerConnectionString(Oid userid,
@ -75,7 +75,7 @@ extern char *ForeignServerConnectionString(Oid userid,
extern UserMapping *GetUserMapping(Oid userid, Oid serverid);
extern ForeignDataWrapper *GetForeignDataWrapper(Oid fdwid);
extern ForeignDataWrapper *GetForeignDataWrapperExtended(Oid fdwid,
bits16 flags);
uint16 flags);
extern ForeignDataWrapper *GetForeignDataWrapperByName(const char *fdwname,
bool missing_ok);
extern ForeignTable *GetForeignTable(Oid relid);

View file

@ -296,7 +296,7 @@ HeapTupleGetDatum(const HeapTupleData *tuple)
#define MAT_SRF_USE_EXPECTED_DESC 0x01 /* use expectedDesc as tupdesc. */
#define MAT_SRF_BLESS 0x02 /* "Bless" a tuple descriptor with
* BlessTupleDesc(). */
extern void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags);
extern void InitMaterializedSRF(FunctionCallInfo fcinfo, uint32 flags);
extern FuncCallContext *init_MultiFuncCall(PG_FUNCTION_ARGS);
extern FuncCallContext *per_MultiFuncCall(PG_FUNCTION_ARGS);

View file

@ -504,7 +504,7 @@ extern void InitializeMaxBackends(void);
extern void InitializeFastPathLocks(void);
extern void InitPostgres(const char *in_dbname, Oid dboid,
const char *username, Oid useroid,
bits32 flags,
uint32 flags,
char *out_dbname);
extern void BaseInit(void);
extern void StoreConnectionWarning(char *msg, char *detail);

View file

@ -793,7 +793,7 @@ typedef struct TableLikeClause
{
NodeTag type;
RangeVar *relation;
bits32 options; /* OR of TableLikeOption flags */
uint32 options; /* OR of TableLikeOption flags */
Oid relationOid; /* If table has been looked up, its OID */
} TableLikeClause;

View file

@ -277,7 +277,7 @@ pg_ceil_log2_64(uint64 num)
}
extern uint64 pg_popcount_portable(const char *buf, int bytes);
extern uint64 pg_popcount_masked_portable(const char *buf, int bytes, bits8 mask);
extern uint64 pg_popcount_masked_portable(const char *buf, int bytes, uint8 mask);
#if defined(HAVE_X86_64_POPCNTQ) || defined(USE_SVE_POPCNT_WITH_RUNTIME_CHECK)
/*
@ -285,12 +285,12 @@ extern uint64 pg_popcount_masked_portable(const char *buf, int bytes, bits8 mask
* first.
*/
extern PGDLLIMPORT uint64 (*pg_popcount_optimized) (const char *buf, int bytes);
extern PGDLLIMPORT uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask);
extern PGDLLIMPORT uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, uint8 mask);
#else
/* Use a portable implementation -- no need for a function pointer. */
extern uint64 pg_popcount_optimized(const char *buf, int bytes);
extern uint64 pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask);
extern uint64 pg_popcount_masked_optimized(const char *buf, int bytes, uint8 mask);
#endif
@ -369,7 +369,7 @@ pg_popcount(const char *buf, int bytes)
* it's likely to be faster.
*/
static inline uint64
pg_popcount_masked(const char *buf, int bytes, bits8 mask)
pg_popcount_masked(const char *buf, int bytes, uint8 mask)
{
/*
* We set the threshold to the point at which we'll first use special

View file

@ -46,7 +46,7 @@ typedef struct
char nuls[2]; /* always \0\0 */
uint16 len; /* size of this chunk (counts data only) */
int32 pid; /* writer's pid */
bits8 flags; /* bitmask of PIPE_PROTO_* */
uint8 flags; /* bitmask of PIPE_PROTO_* */
char data[FLEXIBLE_ARRAY_MEMBER]; /* data payload starts here */
} PipeProtoHeader;

View file

@ -293,7 +293,7 @@ typedef struct ReorderBufferChange
typedef struct ReorderBufferTXN
{
/* See above */
bits32 txn_flags;
uint32 txn_flags;
/* The transaction's transaction id, can be a toplevel or sub xid. */
TransactionId xid;

View file

@ -100,7 +100,7 @@ typedef struct
* can't reload the config file safely, so checkpointer updates this value
* as needed. Protected by SyncRepLock.
*/
bits8 sync_standbys_status;
uint8 sync_standbys_status;
/* used as a registry of physical / logical walsenders to wake */
ConditionVariable wal_flush_cv;

View file

@ -206,7 +206,7 @@ typedef struct ArrayBuildStateArr
{
MemoryContext mcontext; /* where all the temp stuff is kept */
char *data; /* accumulated data */
bits8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */
uint8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */
int abytes; /* allocated length of "data" */
int nbytes; /* number of bytes used so far */
int aitems; /* allocated length of bitmap (in elements) */
@ -299,9 +299,9 @@ typedef struct ArrayIteratorData *ArrayIterator;
#define ARR_NULLBITMAP(a) \
(ARR_HASNULL(a) ? \
(bits8 *) (((char *) (a)) + sizeof(ArrayType) + \
(uint8 *) (((char *) (a)) + sizeof(ArrayType) + \
2 * sizeof(int) * ARR_NDIM(a)) \
: (bits8 *) NULL)
: (uint8 *) NULL)
/*
* The total array header size (in bytes) for an array with the specified
@ -387,8 +387,8 @@ extern Datum array_map(Datum arrayd,
ExprState *exprstate, ExprContext *econtext,
Oid retType, ArrayMapState *amstate);
extern void array_bitmap_copy(bits8 *destbitmap, int destoffset,
const bits8 *srcbitmap, int srcoffset,
extern void array_bitmap_copy(uint8 *destbitmap, int destoffset,
const uint8 *srcbitmap, int srcoffset,
int nitems);
extern ArrayType *construct_array(Datum *elems, int nelems,

View file

@ -40,7 +40,7 @@ typedef struct array_iter
/* Fields used when we have a flat array */
char *dataptr; /* Current spot in the data area */
bits8 *bitmapptr; /* Current byte of the nulls bitmap, or NULL */
uint8 *bitmapptr; /* Current byte of the nulls bitmap, or NULL */
int bitmask; /* mask for current bit in nulls bitmap */
/* Fields used in both cases: data about array's element type */

View file

@ -126,7 +126,7 @@ extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS);
#define FORMAT_TYPE_ALLOW_INVALID 0x02 /* allow invalid types */
#define FORMAT_TYPE_FORCE_QUALIFY 0x04 /* force qualification of type */
#define FORMAT_TYPE_INVALID_AS_NULL 0x08 /* NULL if undefined */
extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags);
extern char *format_type_extended(Oid type_oid, int32 typemod, uint16 flags);
extern char *format_type_be(Oid type_oid);
extern char *format_type_be_qualified(Oid type_oid);

View file

@ -709,7 +709,7 @@ extern void pgstat_archiver_snapshot_cb(void);
#define PGSTAT_BACKEND_FLUSH_WAL (1 << 1) /* Flush WAL statistics */
#define PGSTAT_BACKEND_FLUSH_ALL (PGSTAT_BACKEND_FLUSH_IO | PGSTAT_BACKEND_FLUSH_WAL)
extern bool pgstat_flush_backend(bool nowait, bits32 flags);
extern bool pgstat_flush_backend(bool nowait, uint32 flags);
extern bool pgstat_backend_flush_cb(bool nowait);
extern void pgstat_backend_reset_timestamp_cb(PgStatShared_Common *header,
TimestampTz ts);

View file

@ -18,12 +18,12 @@
/* Control flags for format_procedure_extended */
#define FORMAT_PROC_INVALID_AS_NULL 0x01 /* NULL if undefined */
#define FORMAT_PROC_FORCE_QUALIFY 0x02 /* force qualification */
extern char *format_procedure_extended(Oid procedure_oid, bits16 flags);
extern char *format_procedure_extended(Oid procedure_oid, uint16 flags);
/* Control flags for format_operator_extended */
#define FORMAT_OPERATOR_INVALID_AS_NULL 0x01 /* NULL if undefined */
#define FORMAT_OPERATOR_FORCE_QUALIFY 0x02 /* force qualification */
extern char *format_operator_extended(Oid operator_oid, bits16 flags);
extern char *format_operator_extended(Oid operator_oid, uint16 flags);
extern List *stringToQualifiedNameList(const char *string, Node *escontext);
extern char *format_procedure(Oid procedure_oid);

View file

@ -27,7 +27,7 @@ typedef struct PlannedStmt PlannedStmt;
extern char *pg_get_indexdef_string(Oid indexrelid);
extern char *pg_get_indexdef_columns(Oid indexrelid, bool pretty);
extern char *pg_get_indexdef_columns_extended(Oid indexrelid,
bits16 flags);
uint16 flags);
extern char *pg_get_querydef(Query *query, bool pretty);
extern char *pg_get_partkeydef_columns(Oid relid, bool pretty);

View file

@ -20,7 +20,7 @@
#include "fmgr.h"
/*
* Modeled on varlena from c.h, but data type is bits8.
* Modeled on varlena from c.h, but data type is uint8.
*
* Caution: if bit_len is not a multiple of BITS_PER_BYTE, the low-order
* bits of the last byte of bit_dat[] are unused and MUST be zeroes.
@ -31,7 +31,7 @@ typedef struct
{
int32 vl_len_; /* varlena header (do not touch directly!) */
int32 bit_len; /* number of valid bits */
bits8 bit_dat[FLEXIBLE_ARRAY_MEMBER]; /* bit string, most sig. byte
uint8 bit_dat[FLEXIBLE_ARRAY_MEMBER]; /* bit string, most sig. byte
* first */
} VarBit;
@ -82,7 +82,7 @@ VarBitPGetDatum(const VarBit *X)
*/
#define VARBITMAXLEN (INT_MAX - BITS_PER_BYTE + 1)
/* pointer beyond the end of the bit string (like end() in STL containers) */
#define VARBITEND(PTR) (((bits8 *) (PTR)) + VARSIZE(PTR))
#define VARBITEND(PTR) (((uint8 *) (PTR)) + VARSIZE(PTR))
/* Mask that will cover exactly one byte, i.e. BITS_PER_BYTE bits */
#define BITMASK 0xFF

View file

@ -35,7 +35,7 @@ static PyObject *PLyUnicode_FromScalar(PLyDatumToOb *arg, Datum d);
static PyObject *PLyObject_FromTransform(PLyDatumToOb *arg, Datum d);
static PyObject *PLyList_FromArray(PLyDatumToOb *arg, Datum d);
static PyObject *PLyList_FromArray_recurse(PLyDatumToOb *elm, int *dims, int ndim, int dim,
char **dataptr_p, bits8 **bitmap_p, int *bitmask_p);
char **dataptr_p, uint8 **bitmap_p, int *bitmask_p);
static PyObject *PLyDict_FromComposite(PLyDatumToOb *arg, Datum d);
static PyObject *PLyDict_FromTuple(PLyDatumToOb *arg, HeapTuple tuple, TupleDesc desc, bool include_generated);
@ -671,7 +671,7 @@ PLyList_FromArray(PLyDatumToOb *arg, Datum d)
int ndim;
int *dims;
char *dataptr;
bits8 *bitmap;
uint8 *bitmap;
int bitmask;
if (ARR_NDIM(array) == 0)
@ -705,7 +705,7 @@ PLyList_FromArray(PLyDatumToOb *arg, Datum d)
static PyObject *
PLyList_FromArray_recurse(PLyDatumToOb *elm, int *dims, int ndim, int dim,
char **dataptr_p, bits8 **bitmap_p, int *bitmask_p)
char **dataptr_p, uint8 **bitmap_p, int *bitmask_p)
{
int i;
PyObject *list;
@ -733,7 +733,7 @@ PLyList_FromArray_recurse(PLyDatumToOb *elm, int *dims, int ndim, int dim,
* for this slice.
*/
char *dataptr = *dataptr_p;
bits8 *bitmap = *bitmap_p;
uint8 *bitmap = *bitmap_p;
int bitmask = *bitmask_p;
uint8 typalignby = typalign_to_alignby(elm->typalign);

View file

@ -133,7 +133,7 @@ pg_popcount_portable(const char *buf, int bytes)
* Returns the number of 1-bits in buf after applying the mask to each byte
*/
uint64
pg_popcount_masked_portable(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_portable(const char *buf, int bytes, uint8 mask)
{
uint64 popcnt = 0;
@ -186,7 +186,7 @@ pg_popcount_optimized(const char *buf, int bytes)
* Returns the number of 1-bits in buf after applying the mask to each byte
*/
uint64
pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_optimized(const char *buf, int bytes, uint8 mask)
{
return pg_popcount_masked_portable(buf, bytes, mask);
}

View file

@ -35,7 +35,7 @@
* versions.
*/
static uint64 pg_popcount_neon(const char *buf, int bytes);
static uint64 pg_popcount_masked_neon(const char *buf, int bytes, bits8 mask);
static uint64 pg_popcount_masked_neon(const char *buf, int bytes, uint8 mask);
#ifdef USE_SVE_POPCNT_WITH_RUNTIME_CHECK
@ -43,7 +43,7 @@ static uint64 pg_popcount_masked_neon(const char *buf, int bytes, bits8 mask);
* These are the SVE implementations of the popcount functions.
*/
static uint64 pg_popcount_sve(const char *buf, int bytes);
static uint64 pg_popcount_masked_sve(const char *buf, int bytes, bits8 mask);
static uint64 pg_popcount_masked_sve(const char *buf, int bytes, uint8 mask);
/*
* The function pointers are initially set to "choose" functions. These
@ -52,9 +52,9 @@ static uint64 pg_popcount_masked_sve(const char *buf, int bytes, bits8 mask);
* caller's request.
*/
static uint64 pg_popcount_choose(const char *buf, int bytes);
static uint64 pg_popcount_masked_choose(const char *buf, int bytes, bits8 mask);
static uint64 pg_popcount_masked_choose(const char *buf, int bytes, uint8 mask);
uint64 (*pg_popcount_optimized) (const char *buf, int bytes) = pg_popcount_choose;
uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask) = pg_popcount_masked_choose;
uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, uint8 mask) = pg_popcount_masked_choose;
static inline bool
pg_popcount_sve_available(void)
@ -94,7 +94,7 @@ pg_popcount_choose(const char *buf, int bytes)
}
static uint64
pg_popcount_masked_choose(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_choose(const char *buf, int bytes, uint8 mask)
{
choose_popcount_functions();
return pg_popcount_masked_optimized(buf, bytes, mask);
@ -190,7 +190,7 @@ pg_popcount_sve(const char *buf, int bytes)
*/
pg_attribute_target("arch=armv8-a+sve")
static uint64
pg_popcount_masked_sve(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_sve(const char *buf, int bytes, uint8 mask)
{
svbool_t pred = svptrue_b64();
svuint64_t accum1 = svdup_u64(0),
@ -284,7 +284,7 @@ pg_popcount_optimized(const char *buf, int bytes)
}
uint64
pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_optimized(const char *buf, int bytes, uint8 mask)
{
return pg_popcount_masked_neon(buf, bytes, mask);
}
@ -386,7 +386,7 @@ pg_popcount_neon(const char *buf, int bytes)
* Returns number of 1 bits in buf after applying the mask to each byte
*/
static uint64
pg_popcount_masked_neon(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_neon(const char *buf, int bytes, uint8 mask)
{
uint8x16_t vec,
maskv = vdupq_n_u8(mask);

View file

@ -30,14 +30,14 @@
* follow than "popcnt" for these names.
*/
static uint64 pg_popcount_sse42(const char *buf, int bytes);
static uint64 pg_popcount_masked_sse42(const char *buf, int bytes, bits8 mask);
static uint64 pg_popcount_masked_sse42(const char *buf, int bytes, uint8 mask);
/*
* These are the AVX-512 implementations of the popcount functions.
*/
#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK
static uint64 pg_popcount_avx512(const char *buf, int bytes);
static uint64 pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask);
static uint64 pg_popcount_masked_avx512(const char *buf, int bytes, uint8 mask);
#endif /* USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */
/*
@ -47,9 +47,9 @@ static uint64 pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask);
* caller's request.
*/
static uint64 pg_popcount_choose(const char *buf, int bytes);
static uint64 pg_popcount_masked_choose(const char *buf, int bytes, bits8 mask);
static uint64 pg_popcount_masked_choose(const char *buf, int bytes, uint8 mask);
uint64 (*pg_popcount_optimized) (const char *buf, int bytes) = pg_popcount_choose;
uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask) = pg_popcount_masked_choose;
uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, uint8 mask) = pg_popcount_masked_choose;
#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK
@ -104,7 +104,7 @@ pg_popcount_choose(const char *buf, int bytes)
}
static uint64
pg_popcount_masked_choose(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_choose(const char *buf, int bytes, uint8 mask)
{
choose_popcount_functions();
return pg_popcount_masked(buf, bytes, mask);
@ -174,7 +174,7 @@ pg_popcount_avx512(const char *buf, int bytes)
*/
pg_attribute_target("avx512vpopcntdq,avx512bw")
static uint64
pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_avx512(const char *buf, int bytes, uint8 mask)
{
__m512i val,
vmasked,
@ -280,7 +280,7 @@ pg_popcount_sse42(const char *buf, int bytes)
*/
pg_attribute_no_sanitize_alignment()
static uint64
pg_popcount_masked_sse42(const char *buf, int bytes, bits8 mask)
pg_popcount_masked_sse42(const char *buf, int bytes, uint8 mask)
{
uint64 popcnt = 0;
uint64 maskv = ~UINT64CONST(0) / 0xFF * mask;

View file

@ -141,7 +141,7 @@ worker_spi_main(Datum main_arg)
Oid dboid;
Oid roleoid;
char *p;
bits32 flags = 0;
uint32 flags = 0;
table = palloc_object(worktable);
sprintf(name, "schema%d", index);
@ -154,7 +154,7 @@ worker_spi_main(Datum main_arg)
p += sizeof(Oid);
memcpy(&roleoid, p, sizeof(Oid));
p += sizeof(Oid);
memcpy(&flags, p, sizeof(bits32));
memcpy(&flags, p, sizeof(uint32));
/* Establish signal handlers before unblocking signals. */
pqsignal(SIGHUP, SignalHandlerForConfigReload);
@ -400,7 +400,7 @@ worker_spi_launch(PG_FUNCTION_ARGS)
BgwHandleStatus status;
pid_t pid;
char *p;
bits32 flags = 0;
uint32 flags = 0;
ArrayType *arr = PG_GETARG_ARRAYTYPE_P(3);
Size ndim;
int nelems;
@ -472,7 +472,7 @@ worker_spi_launch(PG_FUNCTION_ARGS)
p += sizeof(Oid);
memcpy(p, &roleoid, sizeof(Oid));
p += sizeof(Oid);
memcpy(p, &flags, sizeof(bits32));
memcpy(p, &flags, sizeof(uint32));
if (!RegisterDynamicBackgroundWorker(&worker, &handle))
PG_RETURN_NULL();

View file

@ -3591,9 +3591,6 @@ bh_node_type
binaryheap
binaryheap_comparator
bitmapword
bits16
bits32
bits8
blockreftable_hash
blockreftable_iterator
bloom_filter