veil_utils.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "postgres.h"
00016 #include "utils/memutils.h"
00017 #include "veil_funcs.h"
00018 #include "veil_datatypes.h"
00019
00020
00021
00022
00023
00024
00025
00026
00027 void *
00028 vl_malloc(size_t size)
00029 {
00030 void *result;
00031 MemoryContext oldcontext = MemoryContextSwitchTo(TopMemoryContext);
00032 result = palloc(size);
00033 (void) MemoryContextSwitchTo(oldcontext);
00034 return result;
00035 }
00036
00037
00038
00039
00040
00041
00042
00043
00044 char *
00045 vl_ObjTypeName(ObjType obj)
00046 {
00047 static char *names[] = {
00048 "Undefined", "ShmemCtl", "Int4",
00049 "Range", "Bitmap", "BitmapArray",
00050 "BitmapHash", "BitmapRef", "Int4Array"
00051 };
00052
00053 if ((obj < OBJ_UNDEFINED) ||
00054 (obj > OBJ_INT4_ARRAY))
00055 {
00056 return "Unknown";
00057 }
00058 else {
00059 return names[obj];
00060 }
00061 }
00062