| 160 | */ |
| 161 | #ifndef FRONTEND |
| 162 | static inline MemoryContext |
| 163 | GetMemoryChunkContext(void *pointer) |
| 164 | { |
| 165 | MemoryContext context; |
| 166 | |
| 167 | /* |
| 168 | * Try to detect bogus pointers handed to us, poorly though we can. |
| 169 | * Presumably, a pointer that isn't MAXALIGNED isn't pointing at an |
| 170 | * allocated chunk. |
| 171 | */ |
| 172 | Assert(pointer != NULL); |
| 173 | Assert(pointer == (void *) MAXALIGN(pointer)); |
| 174 | |
| 175 | /* |
| 176 | * OK, it's probably safe to look at the context. |
| 177 | */ |
| 178 | context = *(MemoryContext *) (((char *) pointer) - sizeof(void *)); |
| 179 | |
| 180 | AssertArg(MemoryContextIsValid(context)); |
| 181 | |
| 182 | return context; |
| 183 | } |
| 184 | #endif |
| 185 | |
| 186 | /* |
no outgoing calls
no test coverage detected