PostgreSQL Source Code: src/include/utils/palloc.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28#ifndef PALLOC_H

29#define PALLOC_H

30

31

32

33

34

35

37

38

39

40

41

42

43

44

46

48{

50 void *arg;

53

54

55

56

57

58

60

61

62

63

64#define MCXT_ALLOC_HUGE 0x01

65#define MCXT_ALLOC_NO_OOM 0x02

66#define MCXT_ALLOC_ZERO 0x04

67

68

69

70

74 Size size, int flags);

76 Size size, Size alignto, int flags);

77

84 Size size, int flags);

86extern void pfree(void *pointer);

87

88

89

90

91

92

93

94

95#define palloc_object(type) ((type *) palloc(sizeof(type)))

96#define palloc0_object(type) ((type *) palloc0(sizeof(type)))

97

98

99

100

101#define palloc_array(type, count) ((type *) palloc(sizeof(type) * (count)))

102#define palloc0_array(type, count) ((type *) palloc0(sizeof(type) * (count)))

103

104

105

106

107

108#define repalloc_array(pointer, type, count) ((type *) repalloc(pointer, sizeof(type) * (count)))

109#define repalloc0_array(pointer, type, oldcount, count) ((type *) repalloc0(pointer, sizeof(type) * (oldcount), sizeof(type) * (count)))

110

111

114

115

116

117

118

119

120

121

122#ifndef FRONTEND

125{

127

129 return old;

130}

131#endif

132

133

136

137

138

139

140

142extern char *pstrdup(const char *in);

144

145extern char *pchomp(const char *in);

146

147

150

151#endif

#define pg_attribute_printf(f, a)

char * MemoryContextStrdup(MemoryContext context, const char *string)

void * MemoryContextAlloc(MemoryContext context, Size size)

struct MemoryContextCallback MemoryContextCallback

void * MemoryContextAllocZero(MemoryContext context, Size size)

char * pstrdup(const char *in)

void MemoryContextRegisterResetCallback(MemoryContext context, MemoryContextCallback *cb)

char * psprintf(const char *fmt,...) pg_attribute_printf(1

static MemoryContext MemoryContextSwitchTo(MemoryContext context)

pg_nodiscard void * repalloc_huge(void *pointer, Size size)

void pfree(void *pointer)

void * palloc0(Size size)

void * MemoryContextAllocAligned(MemoryContext context, Size size, Size alignto, int flags)

void(* MemoryContextCallbackFunction)(void *arg)

char * pchomp(const char *in)

struct MemoryContextData * MemoryContext

void * MemoryContextAllocExtended(MemoryContext context, Size size, int flags)

char * pnstrdup(const char *in, Size len)

void * palloc_extended(Size size, int flags)

pg_nodiscard void * repalloc_extended(void *pointer, Size size, int flags)

char size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3

pg_nodiscard void * repalloc0(void *pointer, Size oldsize, Size size)

pg_nodiscard void * repalloc(void *pointer, Size size)

void * MemoryContextAllocHuge(MemoryContext context, Size size)

PGDLLIMPORT MemoryContext CurrentMemoryContext

void * palloc_aligned(Size size, Size alignto, int flags)

struct MemoryContextCallback * next

MemoryContextCallbackFunction func