-/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/memory.c,v 1.11 2007/10/03 11:11:12 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/memory.c,v 1.12 2007/11/15 21:14:45 momjian Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
};
#ifdef ENABLE_THREAD_SAFETY
-static pthread_key_t auto_mem_key;
-static pthread_once_t auto_mem_once = PTHREAD_ONCE_INIT;
+static pthread_key_t auto_mem_key;
+static pthread_once_t auto_mem_once = PTHREAD_ONCE_INIT;
static void
auto_mem_destructor(void *arg)
}
static void
-set_auto_allocs(struct auto_mem *am)
+set_auto_allocs(struct auto_mem * am)
{
pthread_setspecific(auto_mem_key, am);
}
-
#else
-static struct auto_mem *auto_allocs = NULL;
+static struct auto_mem *auto_allocs = NULL;
+
#define get_auto_allocs() (auto_allocs)
#define set_auto_allocs(am) do { auto_allocs = (am); } while(0)
#endif
do
{
struct auto_mem *act = am;
+
am = am->next;
ecpg_free(act->pointer);
ecpg_free(act);
- } while(am);
+ } while (am);
set_auto_allocs(NULL);
}
}
do
{
struct auto_mem *act = am;
+
am = am->next;
ecpg_free(act);
- } while(am);
+ } while (am);
set_auto_allocs(NULL);
}
}