8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 20:03:03 +01:00

Changed engine to store source file name/line number information for EVERY allocation when DEBUG_GDS_ALLOC is defined. All allocation should be done using FB_NEW or FB_NEW_RPT macros instead of keyword new since now

This commit is contained in:
skidder 2002-09-25 17:12:16 +00:00
parent 99e1f3068f
commit 6d64014e57
76 changed files with 1147 additions and 408 deletions

View File

@ -27,7 +27,7 @@
*
*____________________________________________________________
*
* $Id: alice_meta.epp,v 1.5 2002-04-04 05:31:13 bellardo Exp $
* $Id: alice_meta.epp,v 1.6 2002-09-25 17:12:00 skidder Exp $
*/
#include "firebird.h"
@ -245,7 +245,7 @@ static STR alloc_string(TEXT ** ptr)
p = *ptr;
length = (USHORT) * p++;
string = new(*tdgbl->ALICE_default_pool, length + 1) str;
string = FB_NEW_RPT(*tdgbl->ALICE_default_pool, length + 1) str;
q = (TEXT *) string->str_data;
while (length--)
@ -342,9 +342,9 @@ static TDR get_description(SLONG blob_id[2])
id = gds__vax_integer((UCHAR*) p, id_length);
p += id_length;
if (!trans)
trans = ptr = new(*tdgbl->ALICE_default_pool) tdr;
trans = ptr = FB_NEW(*tdgbl->ALICE_default_pool) tdr;
else {
ptr->tdr_next = new(*tdgbl->ALICE_default_pool) tdr;
ptr->tdr_next = FB_NEW(*tdgbl->ALICE_default_pool) tdr;
ptr = ptr->tdr_next;
}
ptr->tdr_host_site = host_site;
@ -405,7 +405,7 @@ static void parse_fullpath(TDR trans)
if (*q) {
trans->tdr_filename = q + 1;
trans->tdr_remote_site = new(*tdgbl->ALICE_default_pool, q - p + 1) str;
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->ALICE_default_pool, q - p + 1) str;
strncpy((char*) trans->tdr_remote_site->str_data, (char*) p, q - p);
trans->tdr_remote_site->str_data[q - p] = '\0';
}
@ -431,7 +431,7 @@ static void parse_fullpath(TDR trans)
p++;
if (length) {
trans->tdr_remote_site = new(*tdgbl->ALICE_default_pool, length + 1) str;
trans->tdr_remote_site = FB_NEW_RPT(*tdgbl->ALICE_default_pool, length + 1) str;
q = (TEXT *) trans->tdr_remote_site->str_data;
while (length--)
*q++ = *p++;

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: all.cpp,v 1.5 2001-12-29 10:08:21 tamlin Exp $
// $Id: all.cpp,v 1.6 2002-09-25 17:12:00 skidder Exp $
//
#include "../alice/all.h"
@ -80,7 +80,7 @@ void ALLA_init(void)
AliceMemoryPool::create_new_pool();
#else
// TMN: John, what pool to use here?
tdgbl->ALICE_permanent_pool = new (*getDefaultMemoryPool()) AliceMemoryPool;
tdgbl->ALICE_permanent_pool = FB_NEW(*getDefaultMemoryPool()) AliceMemoryPool;
tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool;
#endif
}

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: tdr.cpp,v 1.7 2002-03-11 16:34:00 skywalker Exp $
// $Id: tdr.cpp,v 1.8 2002-09-25 17:12:00 skidder Exp $
//
// 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port
//
@ -926,7 +926,7 @@ static void reattach_database(TDR trans)
trans,
reinterpret_cast<char*>(p)))
{
string = new(*tdgbl->ALICE_default_pool,
string = FB_NEW_RPT(*tdgbl->ALICE_default_pool,
strlen(reinterpret_cast<const char*>(p)) + 1) str;
strcpy(reinterpret_cast<char*>(string->str_data),
reinterpret_cast<const char*>(p));

View File

@ -95,7 +95,7 @@ void* API_ROUTINE gds__alloc(SLONG size_request)
try
{
poolLoader.loadPool();
return FB_MemoryPool->allocate(size_request);
return FB_MemoryPool->allocate(size_request,0);
} catch(...) {}
return 0;
@ -144,7 +144,11 @@ void* operator new(size_t s)
}
#endif // DEV_BUILD
poolLoader.loadPool();
return FB_MemoryPool->allocate(s);
return FB_MemoryPool->allocate(s,0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__
#endif
);
}
/** operator new[] implementation to trap all calls to the default operator
@ -164,16 +168,14 @@ void* operator new[](size_t s)
}
#endif
poolLoader.loadPool();
return FB_MemoryPool->allocate(s);
return FB_MemoryPool->allocate(s,0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__
#endif
);
}
/** Generic operator new to allocate memory from a given pool. Works with
all objects that don't define their own operator new.
**/
void* operator new(size_t s, MemoryPool& p)
{
return p.allocate(s, 0);
}
/** operator delete to handle exceptions thrown while contructing object with
our custom operator new.
@ -219,14 +221,6 @@ void* operator new(size_t s, MemoryPool* p)
}
#endif
/** Generic operator new to allocate memory from a given pool. Works with
all objects that don't define their own operator new.
**/
void* operator new[](size_t s, MemoryPool& p)
{
return p.allocate(s, 0);
}
#ifdef DEBUG_GDS_ALLOC
// Debugging operators new used by FB_NEW macro. Work the same as the above
@ -241,6 +235,24 @@ void* operator new[](size_t s, MemoryPool& p, char *file, int line)
return p.allocate(s, 0, file, line);
}
#else
/** Generic operator new to allocate memory from a given pool. Works with
all objects that don't define their own operator new.
**/
void* operator new(size_t s, MemoryPool& p)
{
return p.allocate(s, 0);
}
/** Generic operator new to allocate memory from a given pool. Works with
all objects that don't define their own operator new.
**/
void* operator new[](size_t s, MemoryPool& p)
{
return p.allocate(s, 0);
}
#endif
/** operator delete[] to handle exceptions thrown while contructing object with

View File

@ -46,17 +46,19 @@ extern ULONG API_ROUTINE gds__free(void* blk);
void* operator new(size_t);
void* operator new[](size_t);
FB_DLL_EXPORT void* operator new(size_t, MemoryPool&);
FB_DLL_EXPORT void operator delete(void* mem, MemoryPool&);
FB_DLL_EXPORT void* operator new[](size_t s, MemoryPool&);
FB_DLL_EXPORT void operator delete[](void* mem, MemoryPool&);
#ifdef DEBUG_GDS_ALLOC
FB_DLL_EXPORT void* operator new(size_t, MemoryPool&, char*, int);
FB_DLL_EXPORT void* operator new[](size_t s, MemoryPool&, char*, int);
#define FB_NEW(pool) new(pool,__FILE__,__LINE__)
#define FB_NEW_RPT(pool,count) new(pool,count,__FILE__,__LINE__)
#else
FB_DLL_EXPORT void* operator new(size_t, MemoryPool&);
FB_DLL_EXPORT void* operator new[](size_t s, MemoryPool&);
#define FB_NEW(pool) new(pool)
#define FB_NEW_RPT(pool,count) new(pool,count)
#endif
FB_DLL_EXPORT void* operator new(size_t, MemoryPool*);
@ -113,10 +115,18 @@ namespace Firebird
allocator(const allocator<DST> &alloc)
: pool(alloc.getPool()), type(alloc.getType()) { }
#ifdef DEBUG_GDS_ALLOC
pointer allocate(size_type s, const void * = 0)
{ return (pointer) (pool ? pool->allocate(sizeof(T) * s) : gds__alloc(sizeof(T)*s)); }
{ return (pointer) (pool ? pool->allocate(sizeof(T) * s, 0,__FILE__, __LINE__) : gds__alloc(sizeof(T)*s)); }
char *_Charalloc(size_type n)
{ return (char*) (pool ? pool->allocate(n) : gds__alloc(n)); }
{ return (char*) (pool ? pool->allocate(n, 0, __FILE__, __LINE__) : gds__alloc(n)); }
#else
pointer allocate(size_type s, const void * = 0)
{ return (pointer) (pool ? pool->allocate(sizeof(T) * s, 0) : gds__alloc(sizeof(T)*s)); }
char *_Charalloc(size_type n)
{ return (char*) (pool ? pool->allocate(n, 0) : gds__alloc(n)); }
#endif
void deallocate(pointer p, size_type s)
{ if (pool) MemoryPool::deallocate(p); else gds__free(p); }
void deallocate(void* p, size_type s)

View File

@ -96,9 +96,9 @@ public:
/// Allocates at least the given number of bytes from the pool and
/// returns a pointer to the memory.
#ifdef DEBUG_GDS_ALLOC
void* allocate(size_t, short = 0, char* = NULL, int = 0);
void* allocate(size_t, short, char*, int);
#else
void* allocate(size_t, short = 0);
void* allocate(size_t, short);
#endif
/// Deallocates memory that has been allocated from ANY MemoryPool.

View File

@ -113,8 +113,8 @@ void ALLD_init()
if (!init_flag)
{
init_flag = true;
DSQL_permanent_pool = new(*getDefaultMemoryPool()) DsqlMemoryPool;
pools = new(*DSQL_permanent_pool) Firebird::vector<DsqlMemoryPool*>
DSQL_permanent_pool = FB_NEW(*getDefaultMemoryPool()) DsqlMemoryPool;
pools = FB_NEW(*DSQL_permanent_pool) Firebird::vector<DsqlMemoryPool*>
(10, *DSQL_permanent_pool, dsql_type_vec);
tdsql->tsql_default = DSQL_permanent_pool;
}

View File

@ -20,7 +20,7 @@
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* $Id: ddl.cpp,v 1.18 2002-09-12 19:53:44 skidder Exp $
* $Id: ddl.cpp,v 1.19 2002-09-25 17:12:05 skidder Exp $
* 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET;
*
@ -2346,7 +2346,7 @@ static void define_procedure( REQ request, NOD_TYPE op)
}
/* Fill req_procedure to allow procedure to self reference */
procedure = new(*tdsql->tsql_default,
procedure = FB_NEW_RPT(*tdsql->tsql_default,
strlen(reinterpret_cast<char*>(procedure_name->str_data))) prc;
procedure->prc_name = procedure->prc_data;
procedure->prc_owner =
@ -2808,7 +2808,7 @@ static void define_trigger( REQ request, NOD node)
gds_random, gds_arg_string,
trigger_name->str_data, 0);
}
relation_node = new(*tdsql->tsql_default, e_rln_count) nod;
relation_node = FB_NEW_RPT(*tdsql->tsql_default, e_rln_count) nod;
node->nod_arg[e_trg_table] = relation_node;
relation_node->nod_type = nod_relation_name;
relation_node->nod_count = e_rln_count;
@ -3739,7 +3739,7 @@ static void define_view_trigger( REQ request, NOD node, NOD rse, NOD items)
stack = request->req_context;
context = (CTX) stack->lls_object;
if (context->ctx_alias) {
sav_context = new(*tdsql->tsql_default) ctx;
sav_context = FB_NEW(*tdsql->tsql_default) ctx;
*sav_context = *context;
}
}
@ -5724,7 +5724,7 @@ static void save_field(REQ request, TEXT* field_name)
return;
}
FLD field = new(*tdsql->tsql_default, strlen(field_name) + 1) fld;
FLD field = FB_NEW_RPT(*tdsql->tsql_default, strlen(field_name) + 1) fld;
strcpy(field->fld_name, field_name);
field->fld_next = relation->rel_fields;
relation->rel_fields = field;
@ -5764,7 +5764,7 @@ static void save_relation( REQ request, STR relation_name)
}
else
{
relation = new(*tdsql->tsql_default, relation_name->str_length) dsql_rel;
relation = FB_NEW_RPT(*tdsql->tsql_default, relation_name->str_length) dsql_rel;
relation->rel_name = relation->rel_data;
relation->rel_owner =
relation->rel_data + relation_name->str_length + 1;

View File

@ -29,7 +29,7 @@
*
*/
/*
$Id: dsql.cpp,v 1.22 2002-09-17 05:58:34 eku Exp $
$Id: dsql.cpp,v 1.23 2002-09-25 17:12:06 skidder Exp $
*/
/**************************************************************
V4 Multi-threading changes.
@ -491,11 +491,11 @@ GDS_DSQL_ALLOCATE_CPP( STATUS* user_status,
database = init((SLONG **) db_handle);
tdsql->tsql_default = new(*DSQL_permanent_pool) DsqlMemoryPool;
tdsql->tsql_default = FB_NEW(*DSQL_permanent_pool) DsqlMemoryPool;
/* allocate the request block */
request = new(*tdsql->tsql_default) req;
request = FB_NEW(*tdsql->tsql_default) req;
request->req_dbb = database;
request->req_pool = tdsql->tsql_default;
@ -613,7 +613,7 @@ STATUS DLL_EXPORT GDS_DSQL_EXECUTE_CPP(STATUS* user_status,
((request->
req_type == REQ_EMBED_SELECT) ? REQ_embedded_sql_cursor : 0);
request->req_open_cursor = open_cursor = new(*DSQL_permanent_pool) opn;
request->req_open_cursor = open_cursor = FB_NEW(*DSQL_permanent_pool) opn;
open_cursor->opn_request = request;
open_cursor->opn_transaction = (SLONG *) * trans_handle;
THD_MUTEX_LOCK(&cursors_mutex);
@ -685,11 +685,11 @@ static STATUS dsql8_execute_immediate_common(STATUS* user_status,
database = init(reinterpret_cast < long **>(db_handle));
tdsql->tsql_default = new(*DSQL_permanent_pool) DsqlMemoryPool;
tdsql->tsql_default = FB_NEW(*DSQL_permanent_pool) DsqlMemoryPool;
/* allocate the request block, then prepare the request */
request = new(*tdsql->tsql_default) req;
request = FB_NEW(*tdsql->tsql_default) req;
request->req_dbb = database;
request->req_pool = tdsql->tsql_default;
request->req_trans = (int *) *trans_handle;
@ -1341,8 +1341,8 @@ STATUS GDS_DSQL_PREPARE_CPP(STATUS* user_status,
/* Because that's the client's allocated statement handle and we
don't want to trash the context in it -- 2001-Oct-27 Ann Harrison */
tdsql->tsql_default = new(*DSQL_permanent_pool) DsqlMemoryPool;
request = new(*tdsql->tsql_default) req;
tdsql->tsql_default = FB_NEW(*DSQL_permanent_pool) DsqlMemoryPool;
request = FB_NEW(*tdsql->tsql_default) req;
request->req_dbb = database;
request->req_pool = tdsql->tsql_default;
request->req_trans = (int *) *trans_handle;
@ -3667,8 +3667,8 @@ static DBB init( SLONG ** db_handle)
}
}
pool = new(*DSQL_permanent_pool) DsqlMemoryPool;
database = new(*pool) dbb;
pool = FB_NEW(*DSQL_permanent_pool) DsqlMemoryPool;
database = FB_NEW(*pool) dbb;
database->dbb_pool = pool;
database->dbb_next = databases;
databases = database;
@ -4122,8 +4122,8 @@ static REQ prepare(
/* allocate the send and receive messages */
request->req_send = new(*tdsql->tsql_default) msg;
request->req_receive = message = new(*tdsql->tsql_default) msg;
request->req_send = FB_NEW(*tdsql->tsql_default) msg;
request->req_receive = message = FB_NEW(*tdsql->tsql_default) msg;
message->msg_number = 1;
#ifdef SCROLLABLE_CURSORS
@ -4131,7 +4131,7 @@ static REQ prepare(
/* allocate a message in which to send scrolling information
outside of the normal send/receive protocol */
request->req_async = message = new(*tdsql->tsql_default) msg;
request->req_async = message = FB_NEW(*tdsql->tsql_default) msg;
message->msg_number = 2;
}
#endif
@ -4180,13 +4180,13 @@ static REQ prepare(
request->req_type == REQ_EXEC_PROCEDURE) {
/* Allocate persistent blr string from request's pool. */
request->req_blr_string = new(*tdsql->tsql_default, 980) str;
request->req_blr_string = FB_NEW_RPT(*tdsql->tsql_default, 980) str;
}
else {
/* Allocate transient blr string from permanent pool so
as not to unnecessarily bloat the request's pool. */
request->req_blr_string = new(*DSQL_permanent_pool, 980) str;
request->req_blr_string = FB_NEW_RPT(*DSQL_permanent_pool, 980) str;
}
request->req_blr_string->str_length = 980;
request->req_blr = request->req_blr_string->str_data;

View File

@ -25,7 +25,7 @@
*
*/
/*
$Id: gen.cpp,v 1.10 2002-09-10 18:28:19 skidder Exp $
$Id: gen.cpp,v 1.11 2002-09-25 17:12:06 skidder Exp $
*/
#include "firebird.h"
@ -114,7 +114,7 @@ UCHAR GEN_expand_buffer( REQ request, UCHAR byte)
ULONG length = request->req_blr_string->str_length + 2048;
DsqlMemoryPool *pool = (MemoryPool::blk_pool(request->req_blr_string) == DSQL_permanent_pool) ?
DSQL_permanent_pool : tdsql->tsql_default;
STR new_buffer = new(*pool, length) str;
STR new_buffer = FB_NEW_RPT(*pool, length) str;
new_buffer->str_length = length;
p = new_buffer->str_data;
@ -669,7 +669,7 @@ void GEN_port( REQ request, MSG message)
/* Allocate buffer for message */
buffer = new(*tdsql->tsql_default, message->msg_length + DOUBLE_ALIGN - 1) str;
buffer = FB_NEW_RPT(*tdsql->tsql_default, message->msg_length + DOUBLE_ALIGN - 1) str;
message->msg_buffer =
(UCHAR *) FB_ALIGN((U_IPTR) buffer->str_data, DOUBLE_ALIGN);

View File

@ -82,7 +82,7 @@ NOD MAKE_constant(STR constant, int numeric_flag)
tdsql = GET_THREAD_DATA;
node = new(*tdsql->tsql_default,
node = FB_NEW_RPT(*tdsql->tsql_default,
(numeric_flag == CONSTANT_TIMESTAMP ||
numeric_flag == CONSTANT_SINT64) ? 2 : 1) nod;
node->nod_type = nod_constant;
@ -223,7 +223,7 @@ NOD MAKE_str_constant(STR constant, SSHORT character_set)
tdsql = GET_THREAD_DATA;
node = new(*tdsql->tsql_default, 1) nod;
node = FB_NEW_RPT(*tdsql->tsql_default, 1) nod;
node->nod_type = nod_constant;
DEV_BLKCHK(constant, dsql_type_str);
@ -1390,7 +1390,7 @@ NOD MAKE_node(NOD_TYPE type, int count)
tdsql = GET_THREAD_DATA;
node = new(*tdsql->tsql_default, count) nod;
node = FB_NEW_RPT(*tdsql->tsql_default, count) nod;
node->nod_type = type;
node->nod_count = count;
@ -1418,7 +1418,7 @@ PAR MAKE_parameter(MSG message, USHORT sqlda_flag, USHORT null_flag)
tdsql = GET_THREAD_DATA;
parameter = new(*tdsql->tsql_default) par;
parameter = FB_NEW(*tdsql->tsql_default) par;
parameter->par_message = message;
parameter->par_next = message->msg_parameters;
if (parameter->par_next != 0)
@ -1488,7 +1488,7 @@ SYM MAKE_symbol(DBB database,
tdsql = GET_THREAD_DATA;
symbol = new(*tdsql->tsql_default, length) sym;
symbol = FB_NEW_RPT(*tdsql->tsql_default, length) sym;
symbol->sym_type = type;
symbol->sym_object = (BLK) object;
symbol->sym_dbb = database;
@ -1523,7 +1523,7 @@ STR MAKE_tagged_string(CONST UCHAR * str_, int length, CONST TEXT * charset)
tdsql = GET_THREAD_DATA;
string = new(*tdsql->tsql_default, length) str;
string = FB_NEW_RPT(*tdsql->tsql_default, length) str;
string->str_charset = const_cast < char *>(charset);
string->str_length = length;
for (p = string->str_data; length; --length)
@ -1576,7 +1576,7 @@ NOD MAKE_variable(FLD field,
tdsql = GET_THREAD_DATA;
var_ = new(*tdsql->tsql_default, strlen(name)) var;
var_ = FB_NEW_RPT(*tdsql->tsql_default, strlen(name)) var;
node = MAKE_node(nod_variable, e_var_count);
node->nod_arg[e_var_variable] = (NOD) var_;
var_->var_msg_number = msg_number;

View File

@ -303,7 +303,7 @@ INTLSYM METD_get_collation(REQ request, STR name)
THREAD_ENTER;
iname = new(*dbb->dbb_pool, name->str_length) intlsym;
iname = FB_NEW_RPT(*dbb->dbb_pool, name->str_length) intlsym;
strcpy(iname->intlsym_name, (TEXT *) name->str_data);
iname->intlsym_type = INTLSYM_collation;
iname->intlsym_flags = 0;
@ -327,7 +327,7 @@ INTLSYM METD_get_collation(REQ request, STR name)
/* Store in the symbol table */
symbol = iname->intlsym_symbol = new(*dbb->dbb_pool, 0) sym;
symbol = iname->intlsym_symbol = FB_NEW_RPT(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) iname;
symbol->sym_string = iname->intlsym_name;
symbol->sym_length = name->str_length;
@ -506,7 +506,7 @@ INTLSYM METD_get_charset(REQ request, USHORT length, UCHAR * name)
THREAD_ENTER;
iname = new(*dbb->dbb_pool, length) intlsym;
iname = FB_NEW_RPT(*dbb->dbb_pool, length) intlsym;
strcpy(iname->intlsym_name, (char*) name);
iname->intlsym_type = INTLSYM_charset;
iname->intlsym_flags = 0;
@ -532,7 +532,7 @@ INTLSYM METD_get_charset(REQ request, USHORT length, UCHAR * name)
/* Store in the symbol table */
symbol = iname->intlsym_symbol = new(*dbb->dbb_pool, 0) sym;
symbol = iname->intlsym_symbol = FB_NEW_RPT(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) iname;
symbol->sym_string = iname->intlsym_name;
symbol->sym_length = length;
@ -646,7 +646,7 @@ STR METD_get_default_charset(REQ request)
/* Terminate ASCIIZ string on first trailing blank */
metd_exact_name(DBB.RDB$CHARACTER_SET_NAME);
length = strlen(DBB.RDB$CHARACTER_SET_NAME);
dbb->dbb_dfl_charset = new(*dbb->dbb_pool, length) str;
dbb->dbb_dfl_charset = FB_NEW_RPT(*dbb->dbb_pool, length) str;
dbb->dbb_dfl_charset->str_length = length;
dbb->dbb_dfl_charset->str_charset = NULL;
str_ = (UCHAR*) DBB.RDB$CHARACTER_SET_NAME;
@ -907,7 +907,7 @@ UDF METD_get_function(REQ request, STR name)
THREAD_ENTER;
udf_ = new(*dbb->dbb_pool, name->str_length) udf;
udf_ = FB_NEW_RPT(*dbb->dbb_pool, name->str_length) udf;
/* Moved below as still can't say for sure it will be stored.
Following the same logic for MET_get_procedure and MET_get_relation
udf_->udf_next = dbb->dbb_functions;
@ -994,7 +994,7 @@ UDF METD_get_function(REQ request, STR name)
else {
DSC* d;
/* udf_param_node = MAKE_node (type_nod, 0); */
udf_param_node = new(*dbb->dbb_pool, 0) nod;
udf_param_node = FB_NEW_RPT(*dbb->dbb_pool, 0) nod;
d = &udf_param_node->nod_desc;
d->dsc_dtype = (X.RDB$FIELD_TYPE != blr_blob) ?
gds_cvt_blr_dtype [X.RDB$FIELD_TYPE] : dtype_blob;
@ -1055,7 +1055,7 @@ UDF METD_get_function(REQ request, STR name)
}
/* udf->udf_arguments = MAKE_node (nod_list, count); */
udf_->udf_arguments = new(*dbb->dbb_pool, arg_count) nod;
udf_->udf_arguments = FB_NEW_RPT(*dbb->dbb_pool, arg_count) nod;
udf_->udf_arguments->nod_type = nod_list;
udf_->udf_arguments->nod_count = arg_count;
@ -1093,7 +1093,7 @@ UDF METD_get_function(REQ request, STR name)
/* Store in the symbol table */
/* The UDF_new_udf flag is not used, so nothing extra to check. */
symbol = udf_->udf_symbol = new(*dbb->dbb_pool, 0) sym;
symbol = udf_->udf_symbol = FB_NEW_RPT(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) udf_;
symbol->sym_string = udf_->udf_name;
symbol->sym_length = name->str_length;
@ -1228,7 +1228,7 @@ PRC METD_get_procedure(REQ request, STR name)
metd_exact_name(X.RDB$OWNER_NAME);
procedure = new(*dbb->dbb_pool,
procedure = FB_NEW_RPT(*dbb->dbb_pool,
name->str_length + strlen(X.RDB$OWNER_NAME)) prc;
procedure->prc_id = X.RDB$PROCEDURE_ID;
@ -1275,7 +1275,7 @@ PRC METD_get_procedure(REQ request, STR name)
/* allocate the field block */
metd_exact_name(PR.RDB$PARAMETER_NAME);
parameter = new(*dbb->dbb_pool,
parameter = FB_NEW_RPT(*dbb->dbb_pool,
strlen(PR.RDB$PARAMETER_NAME)) fld;
parameter->fld_next = *ptr;
*ptr = parameter;
@ -1346,7 +1346,7 @@ PRC METD_get_procedure(REQ request, STR name)
procedure->prc_next = dbb->dbb_procedures;
dbb->dbb_procedures = procedure;
symbol = procedure->prc_symbol = new(*dbb->dbb_pool, 0) sym;
symbol = procedure->prc_symbol = FB_NEW_RPT(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) procedure;
symbol->sym_string = procedure->prc_name;
symbol->sym_length = name->str_length;
@ -1424,13 +1424,13 @@ DSQL_REL METD_get_relation(REQ request, STR name)
metd_exact_name(X.RDB$OWNER_NAME);
if (!X.RDB$RELATION_ID.NULL) {
relation = new(*dbb->dbb_pool,
relation = FB_NEW_RPT(*dbb->dbb_pool,
name->str_length + strlen(X.RDB$OWNER_NAME)) dsql_rel;
relation->rel_id = X.RDB$RELATION_ID;
}
else if (!DDL_ids(request)) {
relation =
new(*tdsql->tsql_default,
FB_NEW_RPT(*tdsql->tsql_default,
name->str_length + strlen(X.RDB$OWNER_NAME)) dsql_rel;
relation->rel_flags |= REL_new_relation;
}
@ -1487,10 +1487,10 @@ DSQL_REL METD_get_relation(REQ request, STR name)
/* Allocate from default or permanent pool as appropriate */
if (relation->rel_flags & REL_new_relation)
*ptr = field = new(*tdsql->tsql_default,
*ptr = field = FB_NEW_RPT(*tdsql->tsql_default,
strlen(RFR.RDB$FIELD_NAME)) fld;
else
*ptr = field = new(*dbb->dbb_pool,
*ptr = field = FB_NEW_RPT(*dbb->dbb_pool,
strlen(RFR.RDB$FIELD_NAME)) fld;
ptr = &field->fld_next;
@ -1539,10 +1539,10 @@ DSQL_REL METD_get_relation(REQ request, STR name)
/* Allocate from default or permanent pool as appropriate */
if (relation->rel_flags & REL_new_relation)
*ptr = field = new(*tdsql->tsql_default,
*ptr = field = FB_NEW_RPT(*tdsql->tsql_default,
strlen(RFR.RDB$FIELD_NAME)) fld;
else
*ptr = field = new(*dbb->dbb_pool,
*ptr = field = FB_NEW_RPT(*dbb->dbb_pool,
strlen(RFR.RDB$FIELD_NAME)) fld;
ptr = &field->fld_next;
@ -1619,7 +1619,7 @@ DSQL_REL METD_get_relation(REQ request, STR name)
/* store in the symbol table unless the relation is not yet committed */
symbol = relation->rel_symbol = new(*dbb->dbb_pool, 0) sym;
symbol = relation->rel_symbol = FB_NEW_RPT(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) relation;
symbol->sym_string = relation->rel_name;
symbol->sym_length = name->str_length;

File diff suppressed because it is too large Load Diff

View File

@ -3829,13 +3829,13 @@ for (token = KEYWORD_getTokens(); token->tok_string; ++token)
SYM symbol;
STR str_;
symbol = new(*DSQL_permanent_pool, 0) sym;
symbol = FB_NEW_RPT(*DSQL_permanent_pool, 0) sym;
symbol->sym_string = (TEXT *) token->tok_string;
symbol->sym_length = strlen (token->tok_string);
symbol->sym_type = SYM_keyword;
symbol->sym_keyword = token->tok_ident;
symbol->sym_version = token->tok_version;
str_ = new(*DSQL_permanent_pool, symbol->sym_length) str;
str_ = FB_NEW_RPT(*DSQL_permanent_pool, symbol->sym_length) str;
str_->str_length = symbol->sym_length;
strncpy ((char*)str_->str_data, (char*)symbol->sym_string, symbol->sym_length);
symbol->sym_object = (void *) str_;
@ -3974,12 +3974,12 @@ tdsql = GET_THREAD_DATA;
if (field_name == NULL)
{
field = new (*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) fld;
field = FB_NEW_RPT(*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) fld;
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
return field;
}
string = (STR) field_name->nod_arg [1];
field = new(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) fld;
field = FB_NEW_RPT(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) fld;
strcpy (field->fld_name, (TEXT*) string->str_data);
return field;
@ -4003,7 +4003,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA;
temp_file = new(*tdsql->tsql_default) fil;
temp_file = FB_NEW(*tdsql->tsql_default) fil;
return temp_file;
}
@ -4039,7 +4039,7 @@ for (l = 0, temp = stack; temp; temp = temp->lls_next)
l++;
old = node;
node = new(*tdsql->tsql_default, l) nod;
node = FB_NEW_RPT(*tdsql->tsql_default, l) nod;
node->nod_count = l;
node->nod_type = nod_list;
node->nod_flags = old->nod_flags;
@ -4074,7 +4074,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA;
node = new(*tdsql->tsql_default, count) nod;
node = FB_NEW_RPT(*tdsql->tsql_default, count) nod;
node->nod_type = type;
node->nod_line = (USHORT) lines_bk;
node->nod_column = (USHORT) (last_token_bk - line_start_bk + 1);
@ -4111,7 +4111,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA;
node = new(*tdsql->tsql_default, count) nod;
node = FB_NEW_RPT(*tdsql->tsql_default, count) nod;
node->nod_type = type;
node->nod_flags = flag;
node->nod_line = (USHORT) lines_bk;

View File

@ -296,7 +296,7 @@ CTX PASS1_make_context( REQ request, NOD relation_node)
}
/* Set up context block */
context = new(*tdsql->tsql_default) ctx;
context = FB_NEW(*tdsql->tsql_default) ctx;
context->ctx_relation = relation;
context->ctx_procedure = procedure;
context->ctx_request = request;
@ -377,7 +377,7 @@ CTX PASS1_make_context( REQ request, NOD relation_node)
if (count)
{
// Initialize this stack variable, and make it look like a node
std::auto_ptr<nod> desc_node(new(*tdsql->tsql_default, 0) nod);
std::auto_ptr<nod> desc_node(FB_NEW_RPT(*tdsql->tsql_default, 0) nod);
for (input = context->ctx_proc_inputs->nod_arg,
field = procedure->prc_inputs;
@ -1073,7 +1073,7 @@ NOD PASS1_statement(REQ request, NOD input, USHORT proc_flag)
ERRD_post(gds_prcmismat, gds_arg_string, name->str_data, 0);
if (count) {
// Initialize this stack variable, and make it look like a node
std::auto_ptr<nod> desc_node(new(*getDefaultMemoryPool(), 0) nod);
std::auto_ptr<nod> desc_node(FB_NEW_RPT(*getDefaultMemoryPool(), 0) nod);
for (ptr = node->nod_arg[e_exe_inputs]->nod_arg,
field = request->req_procedure->prc_inputs;
@ -2590,10 +2590,10 @@ static void pass1_blob( REQ request, NOD input)
request->req_type =
(input->nod_type ==
nod_get_segment) ? REQ_GET_SEGMENT : REQ_PUT_SEGMENT;
request->req_blob = blob = new(*tdsql->tsql_default) blb;
request->req_blob = blob = FB_NEW(*tdsql->tsql_default) blb;
blob->blb_field = field;
blob->blb_open_in_msg = request->req_send;
blob->blb_open_out_msg = new(*tdsql->tsql_default) msg;
blob->blb_open_out_msg = FB_NEW(*tdsql->tsql_default) msg;
blob->blb_segment_msg = request->req_receive;
/* Create a parameter for the blob segment */
@ -2714,7 +2714,7 @@ static NOD pass1_collate( REQ request, NOD sub1, STR collation)
node = MAKE_node(nod_cast, e_cast_count);
field = new(*tdsql->tsql_default, 1) fld;
field = FB_NEW_RPT(*tdsql->tsql_default, 1) fld;
field->fld_name[0] = 0;
node->nod_arg[e_cast_target] = (NOD) field;
node->nod_arg[e_cast_source] = sub1;
@ -3540,7 +3540,7 @@ static NOD pass1_alias_list( REQ request, NOD alias_list)
/* make up a dummy context to hold the resultant relation */
new_context = new(*tdsql->tsql_default) ctx;
new_context = FB_NEW(*tdsql->tsql_default) ctx;
new_context->ctx_context = context->ctx_context;
new_context->ctx_relation = relation;
@ -3553,7 +3553,7 @@ static NOD pass1_alias_list( REQ request, NOD alias_list)
alias_length += static_cast < USHORT > (((STR) * arg)->str_length);
}
alias = new(*tdsql->tsql_default, alias_length) str;
alias = FB_NEW_RPT(*tdsql->tsql_default, alias_length) str;
alias->str_length = alias_length;
p = new_context->ctx_alias = (TEXT *) alias->str_data;
@ -3715,14 +3715,14 @@ static NOD pass1_rse( REQ request, NOD input, NOD order)
sub = sub->nod_arg[e_alias_value];
if (aggregate_found(request, sub, &proj)) {
parent_context = new(*tdsql->tsql_default) ctx;
parent_context = FB_NEW(*tdsql->tsql_default) ctx;
break;
}
}
if (!parent_context && (input->nod_arg[e_sel_group] ||
input->nod_arg[e_sel_having]))
parent_context = new(*tdsql->tsql_default) ctx;
parent_context = FB_NEW(*tdsql->tsql_default) ctx;
if (parent_context) {
parent_context->ctx_context = request->req_context_number++;
@ -4290,7 +4290,7 @@ static NOD pass1_union( REQ request, NOD input, NOD order_list)
/* generate a context for the union itself */
union_context = new(*tdsql->tsql_default) ctx;
union_context = FB_NEW(*tdsql->tsql_default) ctx;
union_context->ctx_context = request->req_context_number++;
/* generate the list of fields to select */
@ -4347,7 +4347,7 @@ static NOD pass1_union( REQ request, NOD input, NOD order_list)
ptr < end; ptr++) {
*ptr = map_node = MAKE_node(nod_map, e_map_count);
map_node->nod_arg[e_map_context] = (NOD) union_context;
map_ = new(*tdsql->tsql_default) map;
map_ = FB_NEW(*tdsql->tsql_default) map;
map_node->nod_arg[e_map_map] = (NOD) map_;
/* set up the MAP between the sub-rses and the union context */
@ -4584,7 +4584,7 @@ static NOD post_map( NOD node, CTX context)
break;
if (!map_) {
map_ = new(*tdsql->tsql_default) map;
map_ = FB_NEW(*tdsql->tsql_default) map;
map_->map_position = count;
map_->map_next = context->ctx_map;
context->ctx_map = map_;

View File

@ -17,13 +17,20 @@ template<SSHORT TYPE = 0>
class pool_alloc : public blk
{
public:
#ifdef DEBUG_GDS_ALLOC
void* operator new(size_t s, MemoryPool& p, char* file, int line)
{ return p.allocate(s, TYPE, file, line); }
void* operator new[](size_t s, MemoryPool& p, char* file, int line)
{ return p.allocate(s, TYPE, file, line); }
#else
void* operator new(size_t s, MemoryPool& p )
{ return p.allocate(s, TYPE); }
void operator delete(void* mem, MemoryPool& p)
{ if (mem) p.deallocate(mem); }
void* operator new[](size_t s, MemoryPool& p)
{ return p.allocate(s, TYPE); }
#endif
void operator delete(void* mem, MemoryPool& p)
{ if (mem) p.deallocate(mem); }
void operator delete[](void* mem, MemoryPool& p)
{ if (mem) p.deallocate(mem); }
@ -40,8 +47,13 @@ template<class RPT, SSHORT TYPE = 0>
class pool_alloc_rpt : public blk
{
public:
#ifdef DEBUG_GDS_ALLOC
void* operator new(size_t s, MemoryPool& p, int rpt, char *file, int line)
{ return p.allocate(s + sizeof(RPT)*rpt, TYPE, file, line); }
#else
void* operator new(size_t s, MemoryPool& p, int rpt)
{ return p.allocate(s + sizeof(RPT)*rpt, TYPE); }
#endif
void operator delete(void* mem, MemoryPool& p,int rpt)
{ if (mem) p.deallocate(mem); }
void operator delete(void* mem) { if (mem) MemoryPool::deallocate(mem); }

View File

@ -639,7 +639,7 @@ void AIL_get_file_list(LLS * stack)
continue;
temp_fname = LOGF_NAME(logf);
fname_term_length = strlen(temp_fname) + 1;
fname = new(*dbb->dbb_permanent, fname_term_length) str();
fname = FB_NEW_RPT(*dbb->dbb_permanent, fname_term_length) str();
MOVE_FAST(temp_fname, (SCHAR*)fname->str_data, fname_term_length);
LLS_PUSH(fname, stack);
}
@ -675,7 +675,7 @@ void AIL_get_file_list(LLS * stack)
while (TRUE) {
if (!(log_flags & WALFH_RAW)) {
fname_term_length = strlen(curr_name) + 1;
fname = new(*dbb->dbb_permanent, fname_term_length) str();
fname = FB_NEW_RPT(*dbb->dbb_permanent, fname_term_length) str();
MOVE_FAST(curr_name, (SCHAR*)fname->str_data, fname_term_length);
LLS_PUSH(fname, stack);
}

View File

@ -136,7 +136,11 @@ TEXT* ALL_cstring(TEXT* in_string)
}
length = strlen(in_string);
#ifdef DEBUG_GDS_ALLOC
string = (STR) pool->allocate(type_str, length, __FILE__, __LINE__);
#else
string = (STR) pool->allocate(type_str, length);
#endif
/* TMN: Here we should really have the following assert */
/* assert(length <= MAX_USHORT); */
string->str_length = (USHORT) length;
@ -205,7 +209,7 @@ void ALL_init(void)
dbb->dbb_permanent->setExtendSize(PERM_EXTEND_SIZE);
dbb->dbb_pools[0] = pool;
dbb->dbb_bufferpool = new(*pool) JrdMemoryPool(CACH_EXTEND_SIZE);
dbb->dbb_bufferpool = FB_NEW(*pool) JrdMemoryPool(CACH_EXTEND_SIZE);
dbb->dbb_pools[1] = dbb->dbb_bufferpool;
}

View File

@ -32,7 +32,7 @@
* readonly databases.
*/
/*
$Id: blb.cpp,v 1.9 2002-06-29 13:00:56 dimitr Exp $
$Id: blb.cpp,v 1.10 2002-09-25 17:12:09 skidder Exp $
*/
#include "firebird.h"
@ -228,7 +228,7 @@ BLB BLB_create2(TDBB tdbb,
if (to_charset == CS_dynamic)
to_charset = tdbb->tdbb_attachment->att_charset;
if ((to_charset != CS_NONE) && (from_charset != to_charset)) {
filter = new(*dbb->dbb_permanent) blf();
filter = FB_NEW(*dbb->dbb_permanent) blf();
filter->blf_filter =
reinterpret_cast<STATUS (*)(USHORT, CTL)>(filter_transliterate_text);
filter_required = TRUE;
@ -670,7 +670,11 @@ SLONG BLB_get_slice(TDBB tdbb,
/* Get someplace to put data */
data = (UCHAR*) dbb->dbb_permanent->allocate(desc->ads_total_length);
data = (UCHAR*) dbb->dbb_permanent->allocate(desc->ads_total_length, 0
#ifdef DEBUG_GDS_ALLOC
,__FILE__, __LINE__
#endif
);
/* zero out memory, so that it does not have to be done for
each element */
@ -806,7 +810,7 @@ void DLL_EXPORT BLB_map_blobs(TDBB tdbb, BLB old_blob, BLB new_blob)
dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
new_map = new(*dbb->dbb_permanent) map();
new_map = FB_NEW(*dbb->dbb_permanent) map();
new_map->map_old_blob = old_blob;
new_map->map_new_blob = new_blob;
@ -1088,7 +1092,7 @@ BLB BLB_open2(TDBB tdbb,
if (to_charset == CS_dynamic)
to_charset = tdbb->tdbb_attachment->att_charset;
if ((to_charset != CS_NONE) && (from_charset != to_charset)) {
filter = new(*dbb->dbb_permanent) blf();
filter = FB_NEW(*dbb->dbb_permanent) blf();
filter->blf_filter =
reinterpret_cast < STATUS (*) (USHORT, CTL) > (filter_transliterate_text);
filter_required = TRUE;
@ -1580,7 +1584,7 @@ void BLB_scalar(TDBB tdbb,
desc.dsc_address = (UCHAR*) temp;
} else {
temp_str =
new(*tdbb->tdbb_default, desc.dsc_length + DOUBLE_ALIGN - 1) str;
FB_NEW_RPT(*tdbb->tdbb_default, desc.dsc_length + DOUBLE_ALIGN - 1) str;
desc.dsc_address =
(UCHAR *) FB_ALIGN((U_IPTR) temp_str->str_data, DOUBLE_ALIGN);
}
@ -1633,7 +1637,7 @@ static ARR alloc_array(TRA transaction, ADS proto_desc)
// Compute size and allocate block
USHORT n = MAX(proto_desc->ads_struct_count, proto_desc->ads_dimensions);
ARR array = new(*transaction->tra_pool, n) arr();
ARR array = FB_NEW_RPT(*transaction->tra_pool, n) arr();
// Copy prototype descriptor
@ -1648,7 +1652,11 @@ static ARR alloc_array(TRA transaction, ADS proto_desc)
// Allocate large block to hold array
array->arr_data =
(UCHAR*)dbb->dbb_permanent->allocate(array->arr_desc.ads_total_length);
(UCHAR*)dbb->dbb_permanent->allocate(array->arr_desc.ads_total_length, 0
#ifdef DEBUG_GDS_ALLOC
,__FILE__, __LINE__
#endif
);
return array;
}
@ -1672,7 +1680,7 @@ static BLB allocate_blob(TDBB tdbb, TRA transaction)
/* Create a blob large enough to hold a single data page */
BLB blob = new(*transaction->tra_pool, dbb->dbb_page_size) blb();
BLB blob = FB_NEW_RPT(*transaction->tra_pool, dbb->dbb_page_size) blb();
blob->blb_attachment = tdbb->tdbb_attachment;
blob->blb_next = transaction->tra_blobs;
transaction->tra_blobs = blob;
@ -1769,7 +1777,7 @@ static STATUS blob_filter( USHORT action,
return SUCCESS;
case ACTION_alloc:
return (STATUS) new(*transaction->tra_pool) ctl();
return (STATUS) FB_NEW(*transaction->tra_pool) ctl();
case ACTION_free:
delete control;
@ -1867,7 +1875,7 @@ static BLB copy_blob(TDBB tdbb, BID source, REL relation, BID destination)
#endif
{
string = new(*tdbb->tdbb_default, input->blb_max_segment) str();
string = FB_NEW_RPT(*tdbb->tdbb_default, input->blb_max_segment) str();
buff = (UCHAR *) string->str_data;
}
else {
@ -2409,7 +2417,7 @@ static void slice_callback(SLICE arg, ULONG count, DSC * descriptors)
tdbb = GET_THREAD_DATA;
tmp_len = array_desc->dsc_length;
tmp_buffer = new(*tdbb->tdbb_default, tmp_len) str();
tmp_buffer = FB_NEW_RPT(*tdbb->tdbb_default, tmp_len) str();
len = MOV_make_string(slice_desc,
INTL_TEXT_TYPE(*array_desc),
&p,

View File

@ -236,12 +236,12 @@ BLF DLL_EXPORT BLF_lookup_internal_filter(TDBB tdbb, SSHORT from, SSHORT to)
if (to == BLOB_text && from >= 0
&& from < sizeof(filters) / sizeof(filters[0])) {
result = new(*dbb->dbb_permanent) blf;
result = FB_NEW(*dbb->dbb_permanent) blf;
result->blf_next = NULL;
result->blf_from = from;
result->blf_to = to;
result->blf_filter = filters[from];
exception_msg = new(*dbb->dbb_permanent, 100) str;
exception_msg = FB_NEW_RPT(*dbb->dbb_permanent, 100) str;
// SIGN ISSUE, arg 1
sprintf((char*)exception_msg->str_data,
"Exception occurred in system provided internal filters for filtering internal subtype %d to text.",

View File

@ -2,6 +2,7 @@
#define _JRD_BLOCK_CACHE_H_
#include "../common/memory/memory_pool.h"
#include "../common/memory/allocators.h"
#include "../jrd/smp_impl.h"
template <class T>
@ -36,7 +37,7 @@ inline T* BlockCache<T>::newBlock()
return result;
}
lock.release();
return new(pool) T;
return FB_NEW(pool) T;
}
template<class T>

View File

@ -64,7 +64,7 @@ BKM BKM_allocate(RSB rsb, USHORT length)
/* allocate the bookmark and link it into the
linked list hanging off the attachment block */
bookmark = new(*dbb->dbb_permanent, length) bkm();
bookmark = FB_NEW_RPT(*dbb->dbb_permanent, length) bkm();
attachment = tdbb->tdbb_attachment;
bookmark->bkm_next = attachment->att_bookmarks;

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________.
*/
/*
$Id: btr.cpp,v 1.6 2002-09-24 12:57:07 eku Exp $
$Id: btr.cpp,v 1.7 2002-09-25 17:12:09 skidder Exp $
*/
#include "firebird.h"
@ -240,7 +240,7 @@ USHORT BTR_all(TDBB tdbb,
if ((SLONG) (root->irt_count * sizeof(IDX)) > *idx_size) {
size = (sizeof(IDX) * MAX_IDX) + ALIGNMENT;
*csb_idx_allocation = new_buffer = new(*dbb->dbb_permanent, size) str();
*csb_idx_allocation = new_buffer = FB_NEW_RPT(*dbb->dbb_permanent, size) str();
buffer = *start_buffer =
(IDX *) FB_ALIGN((U_IPTR) new_buffer->str_data, ALIGNMENT);
*idx_size = size - ALIGNMENT;
@ -2263,7 +2263,11 @@ static USHORT compress_root(TDBB tdbb, IRT page)
dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
temp = (UCHAR *) tdbb->tdbb_default->allocate((SLONG) dbb->dbb_page_size);
temp = (UCHAR *) tdbb->tdbb_default->allocate((SLONG) dbb->dbb_page_size, 0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__
#endif
);
MOVE_FASTER(page, temp, dbb->dbb_page_size);
p = temp + dbb->dbb_page_size;

View File

@ -1414,7 +1414,7 @@ void CCH_init(TDBB tdbb, ULONG number)
while (!bcb_) {
try {
bcb_ = new(*dbb->dbb_bufferpool, number) bcb;
bcb_ = FB_NEW_RPT(*dbb->dbb_bufferpool, number) bcb;
} catch(...) {
/* If the buffer control block can't be allocated, memory is
very low. Recalculate the number of buffers to account for
@ -1782,7 +1782,7 @@ LCK CCH_page_lock(TDBB tdbb)
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
lock = new(*dbb->dbb_bufferpool, sizeof(SLONG)) lck;
lock = FB_NEW_RPT(*dbb->dbb_bufferpool, sizeof(SLONG)) lck;
lock->lck_type = LCK_bdb;
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
lock->lck_length = sizeof(SLONG);
@ -2459,7 +2459,11 @@ BOOLEAN CCH_write_all_shadows(TDBB tdbb,
and set up to release it in case of error */
spare_buffer =
(SLONG *) dbb->dbb_bufferpool->allocate((SLONG) dbb->dbb_page_size);
(SLONG *) dbb->dbb_bufferpool->allocate((SLONG) dbb->dbb_page_size,0
#ifdef DEBUG_GDS_ALLOC
,__FILE__,__LINE__
#endif
);
page = (PAG) spare_buffer;
MOVE_FAST((UCHAR *) bdb->bdb_buffer, (UCHAR *) page, HDR_SIZE);
@ -2585,7 +2589,7 @@ static BDB alloc_bdb(TDBB tdbb, BCB bcb, UCHAR ** memory)
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
bdb_ = new(*dbb->dbb_bufferpool) bdb;
bdb_ = FB_NEW(*dbb->dbb_bufferpool) bdb;
bdb_->bdb_dbb = dbb;
#ifndef PAGE_LATCHING
@ -2999,7 +3003,7 @@ static void THREAD_ROUTINE cache_reader(DBB dbb)
tdbb->tdbb_default = dbb->dbb_bufferpool;
tdbb->tdbb_status_vector = status_vector;
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_attachment = new(*dbb->dbb_bufferpool) att();
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_bufferpool) att();
tdbb->tdbb_attachment->att_database = dbb;
/* This try block is specifically to protect the LCK_init call: if
@ -3167,7 +3171,7 @@ static void THREAD_ROUTINE cache_writer(DBB dbb)
tdbb->tdbb_default = dbb->dbb_bufferpool;
tdbb->tdbb_status_vector = status_vector;
tdbb->tdbb_quantum = QUANTUM;
tdbb->tdbb_attachment = new(*dbb->dbb_bufferpool) att;
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_bufferpool) att;
tdbb->tdbb_attachment->att_database = dbb;
/* This try block is specifically to protect the LCK_init call: if
@ -3439,7 +3443,7 @@ static void check_precedence(TDBB tdbb, WIN * window, SLONG page)
if ( (precedence = bcb->bcb_free) )
bcb->bcb_free = (PRE) precedence->pre_hi;
else
precedence = new(*dbb->dbb_bufferpool) pre;
precedence = FB_NEW(*dbb->dbb_bufferpool) pre;
precedence->pre_low = low;
precedence->pre_hi = high;
@ -3707,7 +3711,7 @@ static void expand_buffers(TDBB tdbb, ULONG number)
old = dbb->dbb_bcb;
old_end = old->bcb_rpt + old->bcb_count;
BCB new_ = new(*dbb->dbb_bufferpool, number) bcb;
BCB new_ = FB_NEW_RPT(*dbb->dbb_bufferpool, number) bcb;
new_->bcb_count = number;
new_->bcb_free_minimum = (SSHORT) MIN(number / 4, 128); /* 25% clean page reserve */
new_->bcb_checkpoint = old->bcb_checkpoint;
@ -4322,7 +4326,7 @@ static SSHORT latch_bdb(
lwt_ = (LWT) BLOCK(que, LWT, lwt_waiters);
}
else {
lwt_ = new(*dbb->dbb_bufferpool) lwt;
lwt_ = FB_NEW(*dbb->dbb_bufferpool) lwt;
QUE_INIT(lwt_->lwt_waiters);
ISC_event_init(&lwt_->lwt_event, 0, 0);
}

View File

@ -30,7 +30,7 @@
* This closes the heart of SF Bug #518282.
*/
/*
$Id: cmp.cpp,v 1.10 2002-09-19 16:02:56 skidder Exp $
$Id: cmp.cpp,v 1.11 2002-09-25 17:12:09 skidder Exp $
*/
#include "firebird.h"
@ -290,7 +290,7 @@ REQ DLL_EXPORT CMP_clone_request(TDBB tdbb,
n =
(USHORT) ((request->req_impure_size - REQ_SIZE + REQ_TAIL - 1) /
REQ_TAIL);
clone = new(*request->req_pool, n) req;
clone = FB_NEW_RPT(*request->req_pool, n) req;
(*vector)[level] = (BLK) clone;
clone->req_attachment = tdbb->tdbb_attachment;
clone->req_count = request->req_count;
@ -356,7 +356,7 @@ REQ DLL_EXPORT CMP_compile2(TDBB tdbb, UCHAR* blr, USHORT internal_flag)
SET_TDBB(tdbb);
JrdMemoryPool* old_pool = tdbb->tdbb_default;
JrdMemoryPool* new_pool = new(*tdbb->tdbb_database->dbb_permanent)
JrdMemoryPool* new_pool = FB_NEW(*tdbb->tdbb_database->dbb_permanent)
JrdMemoryPool;
tdbb->tdbb_default = new_pool;
@ -1636,13 +1636,13 @@ IDL DLL_EXPORT CMP_get_index_lock(TDBB tdbb, REL relation, USHORT id)
if (index->idl_id == id)
return index;
index = new(*dbb->dbb_permanent) idl();
index = FB_NEW(*dbb->dbb_permanent) idl();
index->idl_next = relation->rel_index_locks;
relation->rel_index_locks = index;
index->idl_relation = relation;
index->idl_id = id;
index->idl_lock = lock = new(*dbb->dbb_permanent, 0) lck;
index->idl_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) lck;
lock->lck_parent = dbb->dbb_lock;
lock->lck_dbb = dbb;
lock->lck_key.lck_long = relation->rel_id * 1000 + id;
@ -1724,7 +1724,7 @@ REQ DLL_EXPORT CMP_make_request(TDBB tdbb, CSB * csb_ptr)
count of hold the impure areas. */
int n = (csb->csb_impure - REQ_SIZE + REQ_TAIL - 1) / REQ_TAIL;
request = new(*tdbb->tdbb_default, n) req;
request = FB_NEW_RPT(*tdbb->tdbb_default, n) req;
request->req_count = csb->csb_n_stream;
request->req_pool = tdbb->tdbb_default;
request->req_impure_size = csb->csb_impure;
@ -1919,7 +1919,7 @@ int DLL_EXPORT CMP_post_access(TDBB tdbb,
}
access = new(*tdbb->tdbb_default) acc;
access = FB_NEW(*tdbb->tdbb_default) acc;
/* append the security class to the existing list */
if (last_entry)
@ -1979,7 +1979,7 @@ void DLL_EXPORT CMP_post_resource(
if (resource->rsc_type == type && resource->rsc_id == id)
return;
resource = new(*tdbb->tdbb_default) Rsc;
resource = FB_NEW(*tdbb->tdbb_default) Rsc;
resource->rsc_next = *rsc_ptr;
*rsc_ptr = resource;
resource->rsc_type = type;
@ -2232,7 +2232,7 @@ static UCHAR *alloc_map(TDBB tdbb, CSB * csb, USHORT stream)
SET_TDBB(tdbb);
string = new(*tdbb->tdbb_default, MAP_LENGTH) str;
string = FB_NEW_RPT(*tdbb->tdbb_default, MAP_LENGTH) str;
string->str_length = MAP_LENGTH;
(*csb)->csb_rpt[stream].csb_map = (UCHAR *) string->str_data;
/* TMN: Here we should really have the following assert */

View File

@ -616,7 +616,7 @@ SSHORT CVT2_blob_compare(DSC * arg1, DSC * arg2, FPTR_VOID err)
#ifdef STACK_REDUCTION
/* do a block allocate */
temp_str = new (*tdbb->tdbb_default, sizeof(UCHAR) * (2 * BUFFER_LARGE)) str();
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * (2 * BUFFER_LARGE)) str();
buffer1 = temp_str->str_data;
buffer2 = buffer1 + BUFFER_LARGE;
#endif
@ -783,12 +783,12 @@ SSHORT CVT2_blob_compare(DSC * arg1, DSC * arg2, FPTR_VOID err)
#ifdef STACK_REDUCTION
/* do a block allocate */
temp_str = new (*tdbb->tdbb_default, sizeof(UCHAR) * arg2->dsc_length) str();
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * arg2->dsc_length) str();
dbuf = temp_str->str_data;
#else
if (arg2->dsc_length > BUFFER_LARGE)
{
temp_str = new (*tdbb->tdbb_default, sizeof(UCHAR) * arg2->dsc_length) str();
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * arg2->dsc_length) str();
dbuf = temp_str->str_data;
}
else
@ -916,7 +916,7 @@ USHORT CVT2_make_string2(DSC * desc,
cs2, from_buf, from_len, err);
tempptr = (UCHAR *) temp;
if (needed_len > length) {
*ptr = new(*tdbb->tdbb_default, needed_len) str();
*ptr = FB_NEW_RPT(*tdbb->tdbb_default, needed_len) str();
(*ptr)->str_length = needed_len;
tempptr = (*ptr)->str_data;
length = needed_len;

View File

@ -718,7 +718,7 @@ void DFW_post_work( TRA transaction, ENUM dfw_t type, DSC * desc, USHORT id)
/* Not already posted, so do so now. */
*ptr = work = new(*transaction->tra_pool, length) dfw;
*ptr = work = FB_NEW_RPT(*transaction->tra_pool, length) dfw;
work->dfw_type = type;
work->dfw_id = id;
work->dfw_count = 1;
@ -1854,7 +1854,7 @@ static bool create_relation(TDBB tdbb,
/* Take a relation lock on rel id -1 before actually
generating a relation id. */
work->dfw_lock = lock = new(*tdbb->tdbb_default, sizeof(SLONG)) lck;
work->dfw_lock = lock = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(SLONG)) lck;
lock->lck_dbb = dbb;
lock->lck_attachment = tdbb->tdbb_attachment;
lock->lck_length = sizeof(SLONG);
@ -3194,7 +3194,7 @@ static void get_procedure_dependencies(DFW work)
if (procedure && !NULL_BLOB(blob_id))
{
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new(*dbb->dbb_permanent) JrdMemoryPool;
tdbb->tdbb_default = FB_NEW(*dbb->dbb_permanent) JrdMemoryPool;
MET_get_dependencies(tdbb,
(struct rel*)NULL_PTR,
(TEXT*)NULL_PTR,
@ -3659,7 +3659,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, TRA transaction)
/* Make a temporary field block */
tfb_ = new(*tdbb->tdbb_default) tfb;
tfb_ = FB_NEW(*tdbb->tdbb_default) tfb;
tfb_->tfb_next = stack;
stack = tfb_;
@ -3702,7 +3702,7 @@ static bool make_version(TDBB tdbb, SSHORT phase, DFW work, TRA transaction)
if (external_flag)
{
tfb_ = new(*tdbb->tdbb_default) tfb;
tfb_ = FB_NEW(*tdbb->tdbb_default) tfb;
tfb_->tfb_next = external;
external = tfb_;
assert(FLD.RDB$EXTERNAL_TYPE <= MAX_UCHAR);

View File

@ -433,7 +433,7 @@ void DYN_define_constraint(GBL gbl,
}
unique_count++;
str_ = new(*tdbb->tdbb_default, sizeof(IDS.RDB$FIELD_NAME) - 1) str();
str_ = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(IDS.RDB$FIELD_NAME) - 1) str();
strcpy((char*)str_->str_data, IDS.RDB$FIELD_NAME);
LLS_PUSH(str_, &field_list);
END_FOR;
@ -1729,7 +1729,7 @@ void DYN_define_index(GBL gbl,
break;
case gds_dyn_fld_name:
str_ = new(*tdbb->tdbb_default, field_name_size - 1) str();
str_ = FB_NEW_RPT(*tdbb->tdbb_default, field_name_size - 1) str();
DYN_get_string((TEXT**)ptr, (TEXT*)str_->str_data, field_name_size, TRUE);
LLS_PUSH(str_, &seg_list);
seg_count++;
@ -1837,7 +1837,7 @@ void DYN_define_index(GBL gbl,
break;
case gds_dyn_idx_ref_column:
str_ = new(*tdbb->tdbb_default, field_name_size - 1) str();
str_ = FB_NEW_RPT(*tdbb->tdbb_default, field_name_size - 1) str();
DYN_get_string((TEXT**)ptr, (TEXT*)str_->str_data, field_name_size, TRUE);
LLS_PUSH(str_, &field_list);
referred_cols++;

View File

@ -1501,7 +1501,7 @@ files = NULL;
ERASE FIL;
/****
file = new(*tdbb->tdbb_default, sizeof (FIL.RDB$FILE_NAME) - 1) str();
file = FB_NEW_RPT(*tdbb->tdbb_default, sizeof (FIL.RDB$FILE_NAME) - 1) str();
strcpy (file->str_data, FIL.RDB$FILE_NAME);
LLS_PUSH (file, &files);
****/

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: evl.cpp,v 1.14 2002-09-17 05:58:35 eku Exp $
* $Id: evl.cpp,v 1.15 2002-09-25 17:12:09 skidder Exp $
*/
/*
@ -1821,7 +1821,7 @@ void DLL_EXPORT EVL_make_value(TDBB tdbb, DSC * desc, VLU value)
}
if (!string) {
string = value->vlu_string = new(*tdbb->tdbb_default, length) str();
string = value->vlu_string = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
string->str_length = length;
}
@ -1867,11 +1867,11 @@ USHORT DLL_EXPORT EVL_mb_contains(TDBB tdbb,
len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = new(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data;
}
if (len2 > sizeof(buffer2)) {
buf2 = new(*tdbb->tdbb_default, len2) str();
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data;
}
@ -1924,11 +1924,11 @@ USHORT DLL_EXPORT EVL_mb_like(TDBB tdbb,
len1 = obj->to_wc(NULL, 0, p1, l1, &err_code, &err_pos);
len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = new(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data;
}
if (len2 > sizeof(buffer2)) {
buf2 = new(*tdbb->tdbb_default, len2) str();
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data;
}
@ -1977,11 +1977,11 @@ USHORT DLL_EXPORT EVL_mb_matches(TDBB tdbb,
len1 = obj->to_wc(NULL, 0, p1, l1, &err_code, &err_pos);
len2 = obj->to_wc(NULL, 0, p2, l2, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = new(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data;
}
if (len2 > sizeof(buffer2)) {
buf2 = new(*tdbb->tdbb_default, len2) str();
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data;
}
@ -2037,7 +2037,7 @@ USHORT DLL_EXPORT EVL_mb_sleuth_check(TDBB tdbb,
len1 = obj->to_wc(NULL, 0, search, search_bytes, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = new(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data;
}
@ -2091,11 +2091,11 @@ USHORT DLL_EXPORT EVL_mb_sleuth_merge(TDBB tdbb,
len1 = obj->to_wc(NULL, 0, match, match_bytes, &err_code, &err_pos);
len2 = obj->to_wc(NULL, 0, control, control_bytes, &err_code, &err_pos);
if (len1 > sizeof(buffer1)) {
buf1 = new(*tdbb->tdbb_default, len1) str();
buf1 = FB_NEW_RPT(*tdbb->tdbb_default, len1) str();
pp1 = (USHORT *) buf1->str_data;
}
if (len2 > sizeof(buffer2)) {
buf2 = new(*tdbb->tdbb_default, len2) str();
buf2 = FB_NEW_RPT(*tdbb->tdbb_default, len2) str();
pp2 = (USHORT *) buf2->str_data;
}
@ -3088,7 +3088,7 @@ static DSC *cast(TDBB tdbb, DSC * value, NOD node, VLU impure)
}
if (!string) {
string = impure->vlu_string = new(*tdbb->tdbb_default, length) str();
string = impure->vlu_string = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
string->str_length = length;
}
@ -4524,7 +4524,7 @@ static SSHORT sleuth(TDBB tdbb, NOD node, DSC * desc1, DSC * desc2)
#ifdef STACK_REDUCTION
/* do a block allocate */
temp_str = new(*tdbb->tdbb_default, ((SLONG)
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, ((SLONG)
(sizeof(UCHAR) *
(2 * TEMP_LENGTH + BUFFER_LARGE +
BUFFER_SMALL)))) str();
@ -4650,7 +4650,7 @@ static SSHORT string_boolean(TDBB tdbb, NOD node, DSC * desc1, DSC * desc2)
#ifdef STACK_REDUCTION
/* do a block allocation of local variables */
temp_str =
new(*tdbb->tdbb_default,
FB_NEW_RPT(*tdbb->tdbb_default,
(SLONG) (sizeof(UCHAR) *
(2 * TEMP_LENGTH + BUFFER_LARGE))) str();
temp1 = temp_str->str_data;
@ -4794,7 +4794,7 @@ static SSHORT string_function(
UCHAR *temp3;
SET_TDBB(tdbb);
temp_str = new(*tdbb->tdbb_default, (sizeof(UCHAR) * TEMP_LENGTH)) str();
temp_str = FB_NEW_RPT(*tdbb->tdbb_default, (sizeof(UCHAR) * TEMP_LENGTH)) str();
temp3 = temp_str->str_data;
#endif
@ -4871,7 +4871,7 @@ static DSC *substring(
else
{
USHORT bufflen = MAX(BUFFER_LARGE, length);
STR temp_str = new(*tdbb->tdbb_default, sizeof(UCHAR) * bufflen) str();
STR temp_str = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(UCHAR) * bufflen) str();
UCHAR *buffer = temp_str->str_data;
USHORT datalen = 0;

View File

@ -31,7 +31,7 @@
* to count virtual operations, not real I/O on the underlying tables.
*/
/*
$Id: exe.cpp,v 1.17 2002-09-19 16:02:57 skidder Exp $
$Id: exe.cpp,v 1.18 2002-09-25 17:12:09 skidder Exp $
*/
#include "firebird.h"
@ -1334,7 +1334,7 @@ static void exec_sql(TDBB tdbb, REQ request, DSC* dsc)
UCHAR *p;
vary *v = reinterpret_cast <vary*> (
new(*tdbb->tdbb_transaction->tra_pool) char[BUFFER_LARGE + sizeof(vary)]);
FB_NEW(*tdbb->tdbb_transaction->tra_pool) char[BUFFER_LARGE + sizeof(vary)]);
v->vary_length = BUFFER_LARGE;
SSHORT l;
STATUS *status, local[ISC_STATUS_LENGTH];
@ -1434,7 +1434,7 @@ static void execute_procedure(TDBB tdbb, NOD node)
format = (FMT) procedure->prc_output_msg->nod_arg[e_msg_format];
out_msg_length = format->fmt_length;
temp_buffer =
new(*tdbb->tdbb_default, out_msg_length + DOUBLE_ALIGN - 1) str();
FB_NEW_RPT(*tdbb->tdbb_default, out_msg_length + DOUBLE_ALIGN - 1) str();
out_msg =
(SCHAR *) FB_ALIGN((U_IPTR) temp_buffer->str_data, DOUBLE_ALIGN);
}
@ -1855,7 +1855,7 @@ static NOD looper(TDBB tdbb, REQ request, NOD in_node)
if (variable->vlu_desc.dsc_dtype <= dtype_varying
&& !variable->vlu_string) {
variable->vlu_string =
new(*tdbb->tdbb_default,
FB_NEW_RPT(*tdbb->tdbb_default,
variable->vlu_desc.dsc_length) str();
variable->vlu_string->str_length =
variable->vlu_desc.dsc_length;

View File

@ -559,7 +559,7 @@ public:
{}
static Csb* newCsb(MemoryPool& p, size_t len)
{ return new(p) Csb(p, len); }
{ return FB_NEW(p) Csb(p, len); }
UCHAR* csb_blr;
UCHAR* csb_running;

View File

@ -172,7 +172,7 @@ EXT EXT_file(REL relation, TEXT * file_name, SLONG * description)
if (!_access(ib_file_path, 4))
{
relation->rel_file = file =
new(*dbb->dbb_permanent, strlen(ib_file_path) + 1) ext();
FB_NEW_RPT(*dbb->dbb_permanent, strlen(ib_file_path) + 1) ext();
strcpy(reinterpret_cast<char*>(file->ext_filename), absolute_file);
found_dir = TRUE;
}
@ -182,12 +182,12 @@ EXT EXT_file(REL relation, TEXT * file_name, SLONG * description)
if (!found_dir)
{
relation->rel_file = file =
new(*dbb->dbb_permanent, strlen(file_name) + 1) ext();
FB_NEW_RPT(*dbb->dbb_permanent, strlen(file_name) + 1) ext();
strcpy(reinterpret_cast<char*>(file->ext_filename), file_name);
}
#else
relation->rel_file = file =
new(*dbb->dbb_permanent, (strlen(file_name) + 1)) ext();
FB_NEW_RPT(*dbb->dbb_permanent, (strlen(file_name) + 1)) ext();
strcpy(reinterpret_cast<char*>(file->ext_filename), file_name);
#endif
@ -476,7 +476,7 @@ if (opt->opt_count)
*/
rsb_ = new(*tdbb->tdbb_default,0) Rsb;
rsb_ = FB_NEW_RPT(*tdbb->tdbb_default,0) Rsb;
rsb_->rsb_type = rsb_ext_sequential;
size = sizeof(struct irsb);

View File

@ -169,7 +169,7 @@ EXT EXT_file(REL relation, TEXT * file_name, SLONG * description)
format. */
l = strlen(file_name);
relation->rel_file = file = new(dbb->dbb_permanent, l) ext();
relation->rel_file = file = FB_NEW_RPT(dbb->dbb_permanent, l) ext();
strcpy(file->ext_filename, file_name);
format = file->ext_format = MET_format(tdbb, relation, 0);
expand_format(format, MET_current(tdbb, relation));
@ -243,7 +243,7 @@ EXT EXT_file(REL relation, TEXT * file_name, SLONG * description)
index = (IDX *) (index->idx_rpt + index->idx_count);
}
if (l = (UCHAR *) index - index_buffer) {
string = new(tdbb->tdbb_default, l) str();
string = FB_NEW_RPT(tdbb->tdbb_default, l) str();
MOVE_FAST(index_buffer, string->str_data, l);
file->ext_indices = string->str_data;
}
@ -486,21 +486,21 @@ RSB EXT_optimize(register OPT opt, SSHORT stream, NOD * sort_ptr)
block */
if (dbkey) {
rsb = new(tdbb->tdbb_default, 1) rsb();
rsb = FB_NEW_RPT(tdbb->tdbb_default, 1) rsb();
rsb->rsb_type = rsb_ext_dbkey;
rsb->rsb_count = 1;
size = sizeof(struct irsb_index);
rsb->rsb_arg[0] = (RSB) dbkey;
}
else if (inversion) {
rsb = new(tdbb->tdbb_default, 1) rsb();
rsb = FB_NEW_RPT(tdbb->tdbb_default, 1) rsb();
rsb->rsb_type = rsb_ext_indexed;
rsb->rsb_count = 1;
size = sizeof(struct irsb_index);
rsb->rsb_arg[0] = (RSB) inversion;
}
else {
rsb = new(tdbb->tdbb_default) rsb();
rsb = FB_NEW(tdbb->tdbb_default) rsb();
rsb->rsb_type = rsb_ext_sequential;
size = sizeof(struct irsb);
}

View File

@ -24,7 +24,7 @@
* to signal NULL by testing the flags of the parameter's descriptor.
*/
/*
$Id: fun.epp,v 1.8 2002-09-06 13:05:33 alexpeshkoff Exp $
$Id: fun.epp,v 1.9 2002-09-25 17:12:09 skidder Exp $
*/
#include "firebird.h"
@ -120,7 +120,7 @@ void DLL_EXPORT FUN_evaluate(FUN function, NOD node, VLU value)
a number of data blocks with aligned length */
temp_string =
new(*tdbb->tdbb_default,
FB_NEW_RPT(*tdbb->tdbb_default,
function->fun_temp_length + DOUBLE_ALIGN - 1) str;
MOVE_CLEAR(temp_string->str_data, temp_string->str_length);
temp_ptr =
@ -161,7 +161,7 @@ void DLL_EXPORT FUN_evaluate(FUN function, NOD node, VLU value)
string = NULL;
}
if (!string) {
string = new(*tdbb->tdbb_default, length) str;
string = FB_NEW_RPT(*tdbb->tdbb_default, length) str;
string->str_length = length;
value->vlu_string = string;
}
@ -720,7 +720,7 @@ FUN DLL_EXPORT FUN_lookup_function(TEXT * name)
l = sizeof(struct blob);
length += l;
END_FOR;
function = new(*dbb->dbb_permanent, count + 1) fun;
function = FB_NEW_RPT(*dbb->dbb_permanent, count + 1) fun;
function->fun_count = count;
function->fun_args = args;
function->fun_return_arg = X.RDB$RETURN_ARGUMENT;
@ -739,7 +739,7 @@ FUN DLL_EXPORT FUN_lookup_function(TEXT * name)
causes an exception. This is done at this time to save us from preparing
(thus allocating) this message every time the function is called. */
exception_msg =
new(*dbb->dbb_permanent,
FB_NEW_RPT(*dbb->dbb_permanent,
strlen(EXCEPTION_MESSAGE) + strlen(name) +
strlen(X.RDB$ENTRYPOINT) +
strlen(X.RDB$MODULE_NAME) + 1) str;
@ -792,9 +792,9 @@ FUN DLL_EXPORT FUN_lookup_function(TEXT * name)
else
{
prior = function;
function->fun_symbol = symbol = new(*dbb->dbb_permanent) sym;
function->fun_symbol = symbol = FB_NEW(*dbb->dbb_permanent) sym;
symbol->sym_object = (BLK) function;
string = new(*dbb->dbb_permanent, strlen(name)) str;
string = FB_NEW_RPT(*dbb->dbb_permanent, strlen(name)) str;
strcpy((char*)string->str_data, name);
symbol->sym_string = (TEXT *) string->str_data;
symbol->sym_type = SYM_fun;

View File

@ -175,8 +175,8 @@ int GRANT_privileges( TDBB tdbb, SSHORT phase, DFW work)
try {
str_buffer = new(*dbb->dbb_permanent, ACL_BUFFER_SIZE) str;
str_default_buffer = new(*dbb->dbb_permanent, ACL_BUFFER_SIZE) str;
str_buffer = FB_NEW_RPT(*dbb->dbb_permanent, ACL_BUFFER_SIZE) str;
str_default_buffer = FB_NEW_RPT(*dbb->dbb_permanent, ACL_BUFFER_SIZE) str;
acl = str_buffer->str_data;
@ -798,8 +798,8 @@ TEXT * relation_name, TEXT * owner, USHORT public_priv, ULONG * length_ptr)
/* initialize the field-level acl buffer to include all relation-level privs */
str_field_buffer_start = new(*dbb->dbb_permanent, *length_ptr) str;
str_field_buffer = new(*dbb->dbb_permanent, *length_ptr) str;
str_field_buffer_start = FB_NEW_RPT(*dbb->dbb_permanent, *length_ptr) str;
str_field_buffer = FB_NEW_RPT(*dbb->dbb_permanent, *length_ptr) str;
field_length = start_length = *length_ptr;

View File

@ -478,7 +478,7 @@ IDB IDX_create_index_block(TDBB tdbb, REL relation, UCHAR id)
dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
index_block = new(*dbb->dbb_permanent) idb();
index_block = FB_NEW(*dbb->dbb_permanent) idb();
index_block->idb_id = id;
/* link the block in with the relation linked list */
@ -490,7 +490,7 @@ IDB IDX_create_index_block(TDBB tdbb, REL relation, UCHAR id)
any modification to the index so that the cached information
about the index will be discarded */
index_block->idb_lock = lock = new(*dbb->dbb_permanent, 0) lck;
index_block->idb_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) lck;
lock->lck_parent = dbb->dbb_lock;
lock->lck_dbb = dbb;
lock->lck_key.lck_long = index_block->idb_id;

View File

@ -543,7 +543,7 @@ void INI_init(void)
gfield = &gfields[fld_[RFLD_F_ID]];
desc->dsc_length = gfield->gfld_length;
desc->dsc_dtype = gfield->gfld_dtype;
*itr = field = new(*dbb->dbb_permanent,0) fld();
*itr = field = FB_NEW_RPT(*dbb->dbb_permanent,0) fld();
field->fld_name = names[fld_[RFLD_F_NAME]];
field->fld_length = strlen(field->fld_name);
}

View File

@ -500,7 +500,7 @@ CHARSET_ID src_type, BYTE * src_ptr, USHORT src_len, FPTR_VOID err)
/*
** allocate a temporary buffer that is large enough. 2 = sizeof WCHAR
*/
tmp_buffer = (BYTE *) new(*getDefaultMemoryPool()) char[(SLONG) src_len * 2];
tmp_buffer = (BYTE *) FB_NEW(*getDefaultMemoryPool()) char[(SLONG) src_len * 2];
cs_obj = from_cs->getConvToUnicode();
assert(cs_obj != NULL);
@ -1015,7 +1015,7 @@ static CharSetContainer *internal_charset_container_lookup(TDBB tdbb, SSHORT par
if (!newCs)
return NULL;
cs = new(*dbb->dbb_permanent) CharSetContainer(*dbb->dbb_permanent, newCs);
cs = FB_NEW(*dbb->dbb_permanent) CharSetContainer(*dbb->dbb_permanent, newCs);
if (!cs)
{
delete newCs;
@ -1942,8 +1942,8 @@ public:
(char*)csStruct->charset_space_character),
cs(csStruct)
{
charset_to_unicode = new(p) CsConvert_BC(&cs->charset_to_unicode, false);
charset_from_unicode = new(p) CsConvert_BC(&cs->charset_from_unicode, false);
charset_to_unicode = FB_NEW(p) CsConvert_BC(&cs->charset_to_unicode, false);
charset_from_unicode = FB_NEW(p) CsConvert_BC(&cs->charset_from_unicode, false);
}
~CharSet_BC() { delete cs; }
@ -2293,7 +2293,7 @@ static CharSet *BC_CharSetAllocFunc(MemoryPool &p, SSHORT cs_id, SSHORT unused)
csInitFunc = (CSInitFunc) intl_back_compat_obj_init_lookup(type_charset, cs_id, unused);
assert(csInitFunc != 0);
CHARSET cs = new(p) charset;
CHARSET cs = FB_NEW(p) charset;
memset(cs, 0, sizeof(charset));
if (0 != (*csInitFunc)(cs, cs_id, unused))
@ -2305,7 +2305,7 @@ static CharSet *BC_CharSetAllocFunc(MemoryPool &p, SSHORT cs_id, SSHORT unused)
CharSet *result = 0;
try
{
result = new(p) CharSet_BC(p, cs);
result = FB_NEW(p) CharSet_BC(p, cs);
}
catch(std::exception&)
{
@ -2324,7 +2324,7 @@ static CsConvert *BC_CsConvertAllocFunc(MemoryPool &p, SSHORT from_id, SSHORT to
//cvtInitFunc = (CVTInitFunc) intl_back_compat_obj_init_lookup(type_csconvert, from_id, to_id);
cvtInitFunc = (CVTInitFunc) intl_back_compat_obj_init_lookup(type_csconvert, to_id, from_id);
assert(cvtInitFunc != 0);
CSCONVERT cvt = new(p) csconvert;
CSCONVERT cvt = FB_NEW(p) csconvert;
memset(cvt, 0, sizeof(csconvert));
//if (0 != (*cvtInitFunc)(cvt, from_id, to_id))
@ -2337,7 +2337,7 @@ static CsConvert *BC_CsConvertAllocFunc(MemoryPool &p, SSHORT from_id, SSHORT to
CsConvert *result = 0;
try
{
result = new(p) CsConvert_BC(cvt, true);
result = FB_NEW(p) CsConvert_BC(cvt, true);
}
catch(std::exception&)
{
@ -2355,7 +2355,7 @@ static TextType *BC_TextTypeAllocFunc(MemoryPool &p, SSHORT tt_id, SSHORT unused
ttInitFunc = (TTInitFunc) intl_back_compat_obj_init_lookup(type_texttype, tt_id, unused);
assert(ttInitFunc != 0);
TEXTTYPE tt = new(p) texttype;
TEXTTYPE tt = FB_NEW(p) texttype;
memset(tt, 0, sizeof(texttype));
if (0 != (*ttInitFunc)(tt, tt_id, unused))
@ -2368,11 +2368,11 @@ static TextType *BC_TextTypeAllocFunc(MemoryPool &p, SSHORT tt_id, SSHORT unused
try
{
if (tt->texttype_bytes_per_char == 1 && tt->texttype_fn_to_wc == NULL)
result = new(p) TextType_BC<TextTypeNC>(tt);
result = FB_NEW(p) TextType_BC<TextTypeNC>(tt);
else if (tt->texttype_bytes_per_char == 2 && tt->texttype_fn_to_wc == NULL)
result = new(p) TextType_BC<TextTypeWC>(tt);
result = FB_NEW(p) TextType_BC<TextTypeWC>(tt);
else if (tt->texttype_fn_to_wc != NULL)
result = new(p) TextType_BC<TextTypeMB>(tt);
result = FB_NEW(p) TextType_BC<TextTypeMB>(tt);
else
BUGCHECK(1);
}

View File

@ -47,7 +47,7 @@ class TextType_Binary : public TextTypeNC
{
public:
static TextType *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) TextType_Binary; }
{ return FB_NEW(p) TextType_Binary; }
TextType_Binary() : TextTypeNC(ttype_binary, "C.OCTETS", CS_BINARY, CC_C, 1)
{}
@ -82,7 +82,7 @@ class TextType_UFSS : public TextTypeMB
{
public:
static TextType *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) TextType_UFSS; }
{ return FB_NEW(p) TextType_UFSS; }
TextType_UFSS() : TextTypeMB(ttype_unicode_fss, "C.UNICODE_FSS", CS_UNICODE_FSS, CC_C, 3)
{}
@ -129,7 +129,7 @@ class TextType_ASCII : public TextTypeNC
{
public:
static TextType *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) TextType_ASCII; }
{ return FB_NEW(p) TextType_ASCII; }
TextType_ASCII() : TextTypeNC(ttype_ascii, "C.ASCII", CS_ASCII, CC_C, 1)
{}
@ -165,7 +165,7 @@ class TextType_None : public TextTypeNC
{
public:
static TextType *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) TextType_None; }
{ return FB_NEW(p) TextType_None; }
TextType_None() : TextTypeNC(ttype_none, "C", CS_NONE, CC_C, 1)
{}
@ -201,7 +201,7 @@ class CsConvert_ASCII_UFSS : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_ASCII_UFSS; }
{ return FB_NEW(p) CsConvert_ASCII_UFSS; }
CsConvert_ASCII_UFSS() : CsConvert(0, "DIRECT", CS_ASCII, CS_UNICODE_FSS)
{}
@ -218,7 +218,7 @@ class CsConvert_UFSS_ASCII : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_UFSS_ASCII; }
{ return FB_NEW(p) CsConvert_UFSS_ASCII; }
CsConvert_UFSS_ASCII() : CsConvert(0, "DIRECT", CS_UNICODE_FSS, CS_ASCII)
{}
unsigned short convert(unsigned char *a,
@ -234,7 +234,7 @@ class CsConvert_UFSS_None : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_UFSS_None; }
{ return FB_NEW(p) CsConvert_UFSS_None; }
CsConvert_UFSS_None() : CsConvert(0, "DIRECT", CS_UNICODE_FSS, CS_NONE)
{}
unsigned short convert(unsigned char *a,
@ -250,7 +250,7 @@ class CsConvert_None_Unicode : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_None_Unicode; }
{ return FB_NEW(p) CsConvert_None_Unicode; }
CsConvert_None_Unicode() : CsConvert(0, "DIRECT", CS_NONE, CS_UNICODE101)
{}
unsigned short convert(unsigned char*,
@ -265,7 +265,7 @@ class CsConvert_Unicode_None : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_Unicode_None; }
{ return FB_NEW(p) CsConvert_Unicode_None; }
CsConvert_Unicode_None() : CsConvert(0, "DIRECT", CS_UNICODE101, CS_NONE)
{}
unsigned short convert(unsigned char*,
@ -280,7 +280,7 @@ class CsConvert_ASCII_Unicode : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_ASCII_Unicode; }
{ return FB_NEW(p) CsConvert_ASCII_Unicode; }
CsConvert_ASCII_Unicode() : CsConvert(0, "DIRECT", CS_ASCII, CS_UNICODE101)
{}
unsigned short convert(unsigned char*,
@ -295,7 +295,7 @@ class CsConvert_Unicode_ASCII : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_Unicode_ASCII; }
{ return FB_NEW(p) CsConvert_Unicode_ASCII; }
CsConvert_Unicode_ASCII() : CsConvert(0, "DIRECT", CS_UNICODE101, CS_ASCII)
{}
unsigned short convert(unsigned char*,
@ -310,7 +310,7 @@ class CsConvert_UFSS_Unicode : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_UFSS_Unicode; }
{ return FB_NEW(p) CsConvert_UFSS_Unicode; }
CsConvert_UFSS_Unicode() : CsConvert(0, "DIRECT", CS_UNICODE_FSS, CS_UNICODE101)
{}
unsigned short convert(unsigned char*,
@ -325,7 +325,7 @@ class CsConvert_Unicode_UFSS : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_Unicode_UFSS; }
{ return FB_NEW(p) CsConvert_Unicode_UFSS; }
CsConvert_Unicode_UFSS() : CsConvert(0, "DIRECT", CS_UNICODE101, CS_UNICODE_FSS)
{}
unsigned short convert(unsigned char *a,
@ -341,7 +341,7 @@ class CsConvert_Binary_Unicode : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_Binary_Unicode; }
{ return FB_NEW(p) CsConvert_Binary_Unicode; }
CsConvert_Binary_Unicode() : CsConvert(0, "DIRECT", CS_BINARY, CS_UNICODE101)
{}
unsigned short convert(unsigned char*,
@ -356,7 +356,7 @@ class CsConvert_Unicode_Binary : public CsConvert
{
public:
static CsConvert *object_factory(MemoryPool& p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CsConvert_Unicode_Binary; }
{ return FB_NEW(p) CsConvert_Unicode_Binary; }
CsConvert_Unicode_Binary() : CsConvert(0, "DIRECT", CS_UNICODE101, CS_BINARY)
{}
unsigned short convert(unsigned char*,
@ -371,7 +371,7 @@ class CharSet_None : public CharSet
{
public:
static CharSet *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CharSet_None(p); }
{ return FB_NEW(p) CharSet_None(p); }
CharSet_None(MemoryPool &p) : CharSet(CS_NONE, "NONE", 1, 1, 1, " ")
{
charset_to_unicode = CsConvert_None_Unicode::object_factory(p,0,0);
@ -383,7 +383,7 @@ class CharSet_ASCII : public CharSet
{
public:
static CharSet *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CharSet_ASCII(p); }
{ return FB_NEW(p) CharSet_ASCII(p); }
CharSet_ASCII(MemoryPool &p) : CharSet(CS_ASCII, "ASCII", 1, 1, 1, " ")
{
charset_to_unicode = CsConvert_ASCII_Unicode::object_factory(p,0,0);
@ -395,7 +395,7 @@ class CharSet_Unicode_FSS : public CharSet
{
public:
static CharSet *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CharSet_Unicode_FSS(p); }
{ return FB_NEW(p) CharSet_Unicode_FSS(p); }
CharSet_Unicode_FSS(MemoryPool &p) : CharSet(CS_UNICODE_FSS, "UNICODE_FSS", 1, 1, 1, " ")
{
charset_to_unicode = CsConvert_UFSS_Unicode::object_factory(p,0,0);
@ -407,7 +407,7 @@ class CharSet_Unicode : public CharSet
{
public:
static CharSet *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CharSet_Unicode(p); }
{ return FB_NEW(p) CharSet_Unicode(p); }
CharSet_Unicode(MemoryPool &p) : CharSet(CS_UNICODE101, "UNICODE101", 2, 2, 2, 0)
{
static CONST WCHAR space = 0x0020;
@ -419,7 +419,7 @@ class CharSet_Binary : public CharSet
{
public:
static CharSet *object_factory(MemoryPool &p, CHARSET_ID u1, CHARSET_ID u2)
{ return new(p) CharSet_Binary(p); }
{ return FB_NEW(p) CharSet_Binary(p); }
CharSet_Binary(MemoryPool &p) : CharSet(CS_BINARY, "BINARY", 1, 1, 1, "\0")
{
charset_to_unicode = CsConvert_Binary_Unicode::object_factory(p,0,0);

View File

@ -232,7 +232,7 @@ void trig::compile(tdbb* _tdbb) {
compile_in_progress = TRUE;
old_pool = _tdbb->tdbb_default;
_tdbb->tdbb_default = new(*getDefaultMemoryPool()) JrdMemoryPool;
_tdbb->tdbb_default = FB_NEW(*getDefaultMemoryPool()) JrdMemoryPool;
// Trigger request is not compiled yet. Lets do it now
PAR_blr(_tdbb, relation, blr->str_data,
(CSB)NULL_PTR, (CSB*)NULL_PTR, &request, TRUE,
@ -746,7 +746,7 @@ STATUS DLL_EXPORT GDS_ATTACH_DATABASE(STATUS* user_status,
}
#endif
tdbb->tdbb_attachment = attachment = new(*dbb->dbb_permanent) att();
tdbb->tdbb_attachment = attachment = FB_NEW(*dbb->dbb_permanent) att();
attachment->att_database = dbb;
attachment->att_filename = (is_alias) ?
copy_string(alias_buffer, strlen(alias_buffer)) :
@ -1872,7 +1872,7 @@ STATUS DLL_EXPORT GDS_CREATE_DATABASE(STATUS* user_status,
copy_string(options.dpb_key, strlen(options.dpb_key));
#endif
tdbb->tdbb_attachment = attachment = new(*dbb->dbb_permanent) att();
tdbb->tdbb_attachment = attachment = FB_NEW(*dbb->dbb_permanent) att();
attachment->att_database = dbb;
attachment->att_filename = copy_string(expanded_name, strlen(expanded_name));
attachment->att_next = dbb->dbb_attachments;
@ -3830,7 +3830,7 @@ STATUS DLL_EXPORT GDS_TRANSACT_REQUEST(STATUS* user_status,
transaction = find_transaction(tdbb, *tra_handle, gds_req_wrong_db);
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new_pool = new(*tdbb->tdbb_database->dbb_permanent)
tdbb->tdbb_default = new_pool = FB_NEW(*tdbb->tdbb_database->dbb_permanent)
JrdMemoryPool;
csb = PAR_parse(tdbb, reinterpret_cast < UCHAR * >(blr), FALSE);
@ -4125,7 +4125,7 @@ void JRD_blocked(ATT blocking, BTB * que)
if (block) {
dbb->dbb_free_btbs = block->btb_next;
} else {
block = new(*dbb->dbb_permanent) btb;
block = FB_NEW(*dbb->dbb_permanent) btb;
}
block->btb_thread_id = (SLONG) SCH_current_thread();
@ -4838,7 +4838,7 @@ static STR copy_string(TEXT * ptr, USHORT length)
*
**************************************/
DBB dbb = get_dbb();
STR string = new(*dbb->dbb_permanent, length) str();
STR string = FB_NEW_RPT(*dbb->dbb_permanent, length) str();
string->str_length = length;
MOVE_FAST(ptr, string->str_data, length);
@ -5608,7 +5608,7 @@ static DBB init(TDBB tdbb,
try {
JrdMemoryPool* perm = new(*getDefaultMemoryPool()) JrdMemoryPool;
JrdMemoryPool* perm = FB_NEW(*getDefaultMemoryPool()) JrdMemoryPool;
dbb_ = dbb::newDbb(*perm);
//temp.blk_type = type_dbb;
dbb_->dbb_permanent = perm;
@ -5625,12 +5625,12 @@ static DBB init(TDBB tdbb,
databases = dbb_;
string =
new(*dbb_->dbb_permanent, THREAD_STRUCT_SIZE(MUTX_T, DBB_MUTX_max)) str();
FB_NEW_RPT(*dbb_->dbb_permanent, THREAD_STRUCT_SIZE(MUTX_T, DBB_MUTX_max)) str();
dbb_->dbb_mutexes = (MUTX) THREAD_STRUCT_ALIGN(string->str_data);
THD_MUTEX_INIT_N(dbb_->dbb_mutexes, DBB_MUTX_max);
string =
new(*dbb_->dbb_permanent, THREAD_STRUCT_SIZE(WLCK_T, DBB_WLCK_max)) str();
FB_NEW_RPT(*dbb_->dbb_permanent, THREAD_STRUCT_SIZE(WLCK_T, DBB_WLCK_max)) str();
dbb_->dbb_rw_locks = (WLCK) THREAD_STRUCT_ALIGN(string->str_data);
V4_RW_LOCK_INIT_N(dbb_->dbb_rw_locks, DBB_WLCK_max);
dbb_->dbb_internal = vector = vec::newVector(*dbb_->dbb_permanent, irq_MAX);

View File

@ -110,7 +110,7 @@ class tdbb;
class dbb : private pool_alloc<type_dbb>
{
public:
static dbb* newDbb(MemoryPool& p) { return new(p) dbb(p); }
static dbb* newDbb(MemoryPool& p) { return FB_NEW(p) dbb(p); }
// The deleteDbb function MUST be used to delete a dbb object.
// The function hides some tricky order of operations. Since the
@ -689,9 +689,9 @@ public:
typedef typename Firebird::vector<T>::iterator iterator;
static vec_base* newVector(MemoryPool& p, int len)
{ return new(p) vec_base<T,TYPE>(p, len); }
{ return FB_NEW(p) vec_base<T,TYPE>(p, len); }
static vec_base* newVector(MemoryPool& p, const vec_base& base)
{ return new(p) vec_base<T,TYPE>(p, base); }
{ return FB_NEW(p) vec_base<T,TYPE>(p, base); }
ULONG count() { return vector.size(); }
T& operator[](size_t index) { return vector[index]; }
@ -723,9 +723,9 @@ class vec : public vec_base<BlkPtr, type_vec>
{
public:
static vec* newVector(MemoryPool& p, int len)
{ return new(p) vec(p, len); }
{ return FB_NEW(p) vec(p, len); }
static vec* newVector(MemoryPool& p, const vec& base)
{ return new(p) vec(p, base); }
{ return FB_NEW(p) vec(p, base); }
private:
vec(MemoryPool& p, int len) : vec_base<BlkPtr, type_vec>(p, len) {}
@ -737,9 +737,9 @@ class vcl : public vec_base<SLONG, type_vcl>
{
public:
static vcl* newVector(MemoryPool& p, int len)
{ return new(p) vcl(p, len); }
{ return FB_NEW(p) vcl(p, len); }
static vcl* newVector(MemoryPool& p, const vcl& base)
{ return new(p) vcl(p, base); }
{ return FB_NEW(p) vcl(p, base); }
private:
vcl(MemoryPool& p, int len) : vec_base<SLONG, type_vcl>(p, len) {}
@ -801,7 +801,7 @@ public:
return false; // runtime safety
}
// TMN: Note that this violates "common sense" and should be fixed.
str* res = new(*pPool, new_len+1) str;
str* res = FB_NEW_RPT(*pPool, new_len+1) str;
res->str_length = new_len;
memcpy(res->str_data, s->str_data, s->str_length+1);
str* old = s;

View File

@ -652,9 +652,9 @@ static void open_log(TEXT * file_name, SSHORT file_length, SCHAR * mode)
if (!log_file)
error("can't open log file");
else {
dbb->dbb_log = log = new(*dbb->dbb_permanent) log();
dbb->dbb_log = log = FB_NEW(*dbb->dbb_permanent) log();
log->log_file = log_file;
log->log_string = new(*dbb->dbb_permanent, LOG_BUFFER_LENGTH) str();
log->log_string = FB_NEW_RPT(*dbb->dbb_permanent, LOG_BUFFER_LENGTH) str();
log->log_ptr = log->log_buffer = log->log_string->str_data;
}
#ifdef STACK_REDUCTION

View File

@ -35,7 +35,7 @@
* 2002-09-16 Nickolay Samofatov - Deferred trigger compilation changes
*/
/*
$Id: met.epp,v 1.17 2002-09-24 08:05:54 dimitr Exp $
$Id: met.epp,v 1.18 2002-09-25 17:12:10 skidder Exp $
*/
// This MUST be at the top of the file
#ifdef DARWIN
@ -850,7 +850,7 @@ int MET_get_walinfo(
FOR(REQUEST_HANDLE handle)
LOG IN RDB$LOG_FILES SORTED BY LOG.RDB$FILE_SEQUENCE
logfiles_[num] = new(*dbb->dbb_permanent,
logfiles_[num] = FB_NEW_RPT(*dbb->dbb_permanent,
LGFILE_SIZE + MAX_PATH_LENGTH) logfiles();
strcpy(logfiles_[num]->lg_name, LOG.RDB$FILE_NAME);
logfiles_[num]->lg_size = LOG.RDB$FILE_LENGTH;
@ -1308,13 +1308,13 @@ BLF MET_lookup_filter(TDBB tdbb, SSHORT from, SSHORT to)
ISC_EXT_LIB_PATH_ENV);
if (filter)
{
blf_ = new(*dbb->dbb_permanent) blf();
blf_ = FB_NEW(*dbb->dbb_permanent) blf();
blf_->blf_next = NULL;
blf_->blf_from = from;
blf_->blf_to = to;
blf_->blf_filter = filter;
exception_msg =
new(*dbb->dbb_permanent,
FB_NEW_RPT(*dbb->dbb_permanent,
strlen(EXCEPTION_MESSAGE) +
strlen(X.RDB$FUNCTION_NAME) +
strlen(X.RDB$ENTRYPOINT) +
@ -2154,7 +2154,7 @@ NOD MET_parse_blob(TDBB tdbb,
blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id);
length = blob->blb_length + 10;
temp = new(*tdbb->tdbb_default, length) str();
temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
BLB_get_data(tdbb, blob, temp->str_data, length);
node = PAR_blr( tdbb,
@ -2266,7 +2266,7 @@ void MET_parse_sys_trigger(TDBB tdbb, REL relation)
((trig_flags & TRG_ignore_perm) ? csb_ignore_perm : 0);
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new(*getDefaultMemoryPool()) JrdMemoryPool;
tdbb->tdbb_default = FB_NEW(*getDefaultMemoryPool()) JrdMemoryPool;
PAR_blr(tdbb,
relation,
const_cast<UCHAR*>(blr),
@ -2454,7 +2454,7 @@ PRC MET_procedure(TDBB tdbb, int id, USHORT flags)
if (!procedure)
{
procedure = new(*dbb->dbb_permanent, 0) prc;
procedure = FB_NEW_RPT(*dbb->dbb_permanent, 0) prc;
}
try {
@ -2463,7 +2463,7 @@ PRC MET_procedure(TDBB tdbb, int id, USHORT flags)
procedure->prc_id = id;
(*vector)[id] = (BLK) procedure;
procedure->prc_existence_lock = lock = new(*dbb->dbb_permanent, 0) lck;
procedure->prc_existence_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) lck;
lock->lck_parent = dbb->dbb_lock;
lock->lck_dbb = dbb;
lock->lck_key.lck_long = procedure->prc_id;
@ -2544,7 +2544,7 @@ PRC MET_procedure(TDBB tdbb, int id, USHORT flags)
/* should be error if field already exists */
parameter =
new(*dbb->dbb_permanent, name_length(PA.RDB$PARAMETER_NAME)) prm();
FB_NEW_RPT(*dbb->dbb_permanent, name_length(PA.RDB$PARAMETER_NAME)) prm();
parameter->prm_number = PA.RDB$PARAMETER_NUMBER;
(*vector)[parameter->prm_number] = (BLK) parameter;
name_copy(parameter->prm_string, PA.RDB$PARAMETER_NAME);
@ -2586,7 +2586,7 @@ PRC MET_procedure(TDBB tdbb, int id, USHORT flags)
}
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new(*getDefaultMemoryPool()) JrdMemoryPool;
tdbb->tdbb_default = FB_NEW(*getDefaultMemoryPool()) JrdMemoryPool;
csb_ = Csb::newCsb(*tdbb->tdbb_default, 5);
csb_->csb_rpt.resize(5); // vec always allocates one too many
csb_->csb_count = 5;
@ -2686,14 +2686,14 @@ REL MET_relation(TDBB tdbb, USHORT id)
else
max_sys_rel = (USHORT) USER_DEF_REL_INIT_ID - 1;
relation = new(*dbb->dbb_permanent) rel();
relation = FB_NEW(*dbb->dbb_permanent) rel();
(*vector)[id] = (BLK) relation;
relation->rel_id = id;
if (relation->rel_id <= max_sys_rel)
return relation;
relation->rel_existence_lock = lock = new(*dbb->dbb_permanent, 0) lck;
relation->rel_existence_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) lck;
lock->lck_parent = dbb->dbb_lock;
lock->lck_dbb = dbb;
lock->lck_key.lck_long = relation->rel_id;
@ -3179,7 +3179,7 @@ void MET_scan_relation( TDBB tdbb, REL relation)
}
else
{
string = new(*tdbb->tdbb_default, blob->blb_max_segment) str();
string = FB_NEW_RPT(*tdbb->tdbb_default, blob->blb_max_segment) str();
buffer = string->str_data;
}
@ -3219,11 +3219,11 @@ void MET_scan_relation( TDBB tdbb, REL relation)
if (!strcmp((char*)p, (char*)field->fld_name))
break;
name = new(*dbb->dbb_permanent, length) str();
name = FB_NEW_RPT(*dbb->dbb_permanent, length) str();
field->fld_name = (TEXT *) name->str_data;
}
else {
field = new(*dbb->dbb_permanent, length) fld();
field = FB_NEW_RPT(*dbb->dbb_permanent, length) fld();
(*vector)[field_id] = (BLK) field;
field->fld_name = (TEXT *) field->fld_string;
}
@ -3299,7 +3299,7 @@ void MET_scan_relation( TDBB tdbb, REL relation)
break;
case RSR_dimensions:
field->fld_array = array = new(*dbb->dbb_permanent, n) arr();
field->fld_array = array = FB_NEW_RPT(*dbb->dbb_permanent, n) arr();
array->arr_desc.ads_dimensions = n;
break;
@ -3618,12 +3618,12 @@ static void get_trigger(
return;
old_pool = tdbb->tdbb_default;
tdbb->tdbb_default = new(*getDefaultMemoryPool()) JrdMemoryPool;
tdbb->tdbb_default = FB_NEW(*getDefaultMemoryPool()) JrdMemoryPool;
DBB dbb = tdbb->tdbb_database;
BLB blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id);
SLONG length = blob->blb_length + 10;
STR blr = new(*tdbb->tdbb_default,length) str();
STR blr = FB_NEW_RPT(*tdbb->tdbb_default,length) str();
BLB_get_data(tdbb, blob, blr->str_data, length);
tdbb->tdbb_default = old_pool;
@ -3723,7 +3723,7 @@ static void lookup_view_contexts( TDBB tdbb, REL view)
/* allocate a view context block and link it in
to the relation block's linked list */
view_context = new(*tdbb->tdbb_default) vcx();
view_context = FB_NEW(*tdbb->tdbb_default) vcx();
*vcx_ptr = view_context;
vcx_ptr = &view_context->vcx_next;
@ -3732,7 +3732,7 @@ static void lookup_view_contexts( TDBB tdbb, REL view)
/* allocate a string block for the context name */
length = name_length(V.RDB$CONTEXT_NAME);
alias = new(*tdbb->tdbb_default, length + 1) str();
alias = FB_NEW_RPT(*tdbb->tdbb_default, length + 1) str();
V.RDB$CONTEXT_NAME[length] = 0;
strcpy((char*)alias->str_data, V.RDB$CONTEXT_NAME);
alias->str_length = length;
@ -3742,7 +3742,7 @@ static void lookup_view_contexts( TDBB tdbb, REL view)
/* allocate a string block for the relation name */
length = name_length(V.RDB$RELATION_NAME);
alias = new(*tdbb->tdbb_default, length + 1) str();
alias = FB_NEW_RPT(*tdbb->tdbb_default, length + 1) str();
V.RDB$RELATION_NAME[length] = 0;
strcpy((char*)alias->str_data, V.RDB$RELATION_NAME);
alias->str_length = length;
@ -3830,7 +3830,7 @@ static NOD parse_procedure_blr(
blob = BLB_open(tdbb, dbb->dbb_sys_trans, (BID)blob_id);
length = blob->blb_length + 10;
temp = new(*tdbb->tdbb_default, length) str();
temp = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
BLB_get_data(tdbb, blob, temp->str_data, length);
(*csb_ptr)->csb_blr = temp->str_data;
par_messages(tdbb, temp->str_data, (USHORT) blob->blb_length, procedure,
@ -4091,7 +4091,7 @@ static STR save_name(TDBB tdbb, CONST TEXT* name)
dbb = tdbb->tdbb_database;
l = name_length(name);
string = new(*dbb->dbb_permanent, l) str();
string = FB_NEW_RPT(*dbb->dbb_permanent, l) str();
string->str_length = l;
p = (TEXT *) string->str_data;
@ -4123,7 +4123,7 @@ static void save_trigger_data(TDBB tdbb, TRIG_VEC* ptr, REL relation, REQ reques
TRIG_VEC vector = *ptr;
if (!vector) {
vector = new(*tdbb->tdbb_database->dbb_permanent)
vector = FB_NEW(*tdbb->tdbb_database->dbb_permanent)
trig_vec(n+1, *tdbb->tdbb_database->dbb_permanent);
*ptr = vector;
} else {

View File

@ -626,7 +626,7 @@ static FIL dfs_setup_file(dbb, file_name, file_length, desc)
ULONG len;
/* Allocate file block and copy file name string */
file = new(*dbb->dbb_permanent, file_length + 1) fil();
file = FB_NEW_RPT(*dbb->dbb_permanent, file_length + 1) fil();
file->fil_desc = desc;
file->fil_length = file_length;
file->fil_max_page = -1;
@ -667,7 +667,7 @@ static FIL dfs_setup_file(dbb, file_name, file_length, desc)
l = p - lock_string;
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, l) lck();
dbb->dbb_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, l) lck();
lock->lck_type = LCK_database;
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
lock->lck_object = reinterpret_cast<blk*>(dbb);

View File

@ -27,7 +27,7 @@
* stored procedure doesn't access tables, views or other procedures directly.
*/
/*
$Id: opt.cpp,v 1.12 2002-09-17 05:58:36 eku Exp $
$Id: opt.cpp,v 1.13 2002-09-25 17:12:10 skidder Exp $
*/
#include "firebird.h"
@ -357,7 +357,7 @@ RSB OPT_compile(TDBB tdbb,
#else
opt_ = new(*dbb->dbb_permanent) Opt();
opt_ = FB_NEW(*dbb->dbb_permanent) Opt();
#endif
@ -452,7 +452,7 @@ RSB OPT_compile(TDBB tdbb,
if (rsb) {
i = local_streams[0];
river = new(*tdbb->tdbb_default, i) riv();
river = FB_NEW_RPT(*tdbb->tdbb_default, i) riv();
river->riv_count = (UCHAR) i;
river->riv_rsb = rsb;
MOVE_FAST(local_streams + 1, river->riv_streams, i);
@ -942,7 +942,7 @@ void OPT_set_index(TDBB tdbb,
/* set up a dummy optimizer block just for the purposes
of the set index, to pass information to subroutines */
opt = new(*dbb->dbb_permanent) Opt();
opt = FB_NEW(*dbb->dbb_permanent) Opt();
opt->opt_g_flags |= opt_g_stream;
/* generate a new rsb for the retrieval, making sure to
@ -2902,7 +2902,7 @@ static BOOLEAN form_river(TDBB tdbb,
SET_TDBB(tdbb);
csb = opt->opt_csb;
/* Allocate a river block and move the best order into it */
river = new(*tdbb->tdbb_default, count) riv();
river = FB_NEW_RPT(*tdbb->tdbb_default, count) riv();
LLS_PUSH(river, river_stack);
river->riv_count = (UCHAR) count;
if (count == 1) {
@ -2910,7 +2910,7 @@ static BOOLEAN form_river(TDBB tdbb,
ptr = &river->riv_rsb;
}
else {
river->riv_rsb = rsb = new(*tdbb->tdbb_default, count) Rsb();
river->riv_rsb = rsb = FB_NEW_RPT(*tdbb->tdbb_default, count) Rsb();
rsb->rsb_type = rsb_cross;
rsb->rsb_count = count;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
@ -3005,7 +3005,7 @@ static RSB gen_aggregate(TDBB tdbb, OPT opt, NOD node)
/* allocate and optimize the record source block */
rsb = new(*tdbb->tdbb_default, 1) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) Rsb();
rsb->rsb_type = rsb_aggregate;
rsb->rsb_stream = (UCHAR) node->nod_arg[e_agg_stream];
rsb->rsb_format = csb->csb_rpt[rsb->rsb_stream].csb_format;
@ -3096,7 +3096,7 @@ static RSB gen_boolean(TDBB tdbb, register OPT opt, RSB prior_rsb, NOD node)
DEV_BLKCHK(prior_rsb, type_rsb);
SET_TDBB(tdbb);
csb = opt->opt_csb;
rsb = new(*tdbb->tdbb_default, 1) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) Rsb();
rsb->rsb_count = 1;
rsb->rsb_type = rsb_boolean;
rsb->rsb_next = prior_rsb;
@ -3131,7 +3131,7 @@ static RSB gen_first(TDBB tdbb, register OPT opt, RSB prior_rsb, NOD node)
DEV_BLKCHK(node, type_nod);
SET_TDBB(tdbb);
csb = opt->opt_csb;
rsb = new(*tdbb->tdbb_default, 1) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) Rsb();
rsb->rsb_count = 1;
rsb->rsb_type = rsb_first;
rsb->rsb_next = prior_rsb;
@ -3194,7 +3194,7 @@ static void gen_join(TDBB tdbb,
relation) * dbb->dbb_page_size /
format->fmt_length;}
river = new(*tdbb->tdbb_default, 1) riv();
river = FB_NEW_RPT(*tdbb->tdbb_default, 1) riv();
river->riv_count = 1;
river->riv_rsb =
gen_retrieval(tdbb, opt, streams[1], sort_clause, project_clause,
@ -3408,7 +3408,7 @@ static RSB gen_nav_rsb(TDBB tdbb,
DEV_BLKCHK(alias, type_str);
SET_TDBB(tdbb);
key_length = ROUNDUP(BTR_key_length(relation, idx), sizeof(SLONG));
rsb = new(*tdbb->tdbb_default, RSB_NAV_count) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_NAV_count) Rsb();
rsb->rsb_type = rsb_navigate;
rsb->rsb_relation = relation;
rsb->rsb_stream = (UCHAR) stream;
@ -3524,7 +3524,7 @@ static RSB gen_outer(TDBB tdbb,
stream_i.stream_rsb =
gen_residual_boolean(tdbb, opt, stream_i.stream_rsb);
/* Allocate and fill in the rsb */
rsb = new(*tdbb->tdbb_default, RSB_LEFT_count) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_LEFT_count) Rsb();
rsb->rsb_type = rsb_left_cross;
rsb->rsb_count = 2;
rsb->rsb_impure = CMP_impure(opt->opt_csb, sizeof(struct irsb));
@ -3567,7 +3567,7 @@ static RSB gen_procedure(TDBB tdbb, OPT opt, NOD node)
SET_TDBB(tdbb);
csb = opt->opt_csb;
procedure = (PRC) node->nod_arg[e_prc_procedure];
rsb = new(*tdbb->tdbb_default, RSB_PRC_count) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, RSB_PRC_count) Rsb();
rsb->rsb_type = rsb_procedure;
rsb->rsb_stream = (UCHAR) node->nod_arg[e_prc_stream];
rsb->rsb_procedure = procedure;
@ -3890,14 +3890,14 @@ static RSB gen_rsb(TDBB tdbb,
}
else {
if (inversion) {
rsb = new(*tdbb->tdbb_default, 1) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) Rsb();
rsb->rsb_type = rsb_indexed;
rsb->rsb_count = 1;
size = sizeof(struct irsb_index);
rsb->rsb_arg[0] = (RSB) inversion;
}
else {
rsb = new(*tdbb->tdbb_default, 0) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 0) Rsb();
rsb->rsb_type = rsb_sequential;
size = sizeof(struct irsb);
if (boolean)
@ -3953,7 +3953,7 @@ static RSB gen_skip (TDBB tdbb, register OPT opt, RSB prior_rsb, NOD node)
SET_TDBB (tdbb);
csb = opt->opt_csb;
rsb = new(*tdbb->tdbb_default, 0) Rsb(); // was : rsb = (RSB) ALLOCDV (type_rsb, 1);
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 0) Rsb(); // was : rsb = (RSB) ALLOCDV (type_rsb, 1);
rsb->rsb_count = 1;
rsb->rsb_type = rsb_skip;
rsb->rsb_next = prior_rsb;
@ -4049,7 +4049,7 @@ static RSB gen_sort(TDBB tdbb,
count = items +
(sizeof(SKD) * 2 * sort->nod_count + sizeof(smb_repeat) -
1) / sizeof(smb_repeat);
map = new(*tdbb->tdbb_default, count) smb();
map = FB_NEW_RPT(*tdbb->tdbb_default, count) smb();
map->smb_keys = sort->nod_count * 2;
map->smb_count = items;
if (project_flag)
@ -4212,7 +4212,7 @@ static RSB gen_sort(TDBB tdbb,
/* That was most unpleasant. Never the less, it's done (except for
the debugging). All that remains is to build the record source
block for the sort. */
rsb = new(*tdbb->tdbb_default, 1) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, 1) Rsb();
rsb->rsb_type = rsb_sort;
rsb->rsb_next = prior_rsb;
rsb->rsb_arg[0] = (RSB) map;
@ -4335,7 +4335,7 @@ static BOOLEAN gen_sort_merge(TDBB tdbb, OPT opt, LLS * org_rivers)
*selected_class = NULL;
class_cnt = selected_class - selected_classes;
/* Build a sort stream */
merge_rsb = new(*tdbb->tdbb_default, river_cnt * 2) Rsb();
merge_rsb = FB_NEW_RPT(*tdbb->tdbb_default, river_cnt * 2) Rsb();
merge_rsb->rsb_count = river_cnt;
merge_rsb->rsb_type = rsb_merge;
merge_rsb->rsb_impure = CMP_impure(opt->opt_csb,
@ -4352,7 +4352,7 @@ static BOOLEAN gen_sort_merge(TDBB tdbb, OPT opt, LLS * org_rivers)
if (!(TEST_DEP_BIT(selected_rivers, river1->riv_number)))
continue;
stream_cnt += river1->riv_count;
sort = new(*tdbb->tdbb_default, class_cnt * 2) nod();
sort = FB_NEW_RPT(*tdbb->tdbb_default, class_cnt * 2) nod();
sort->nod_type = nod_sort;
sort->nod_count = class_cnt;
for (selected_class = selected_classes, ptr = sort->nod_arg;
@ -4367,7 +4367,7 @@ static BOOLEAN gen_sort_merge(TDBB tdbb, OPT opt, LLS * org_rivers)
/* Finally, merge selected rivers into a single river, and rebuild original
river stack */
river1 = new(*tdbb->tdbb_default, stream_cnt) riv();
river1 = FB_NEW_RPT(*tdbb->tdbb_default, stream_cnt) riv();
river1->riv_count = (UCHAR) stream_cnt;
river1->riv_rsb = merge_rsb;
stream = river1->riv_streams;
@ -4429,7 +4429,7 @@ static RSB gen_union(TDBB tdbb,
clauses = union_node->nod_arg[e_uni_clauses];
count = clauses->nod_count;
csb = opt->opt_csb;
rsb = new(*tdbb->tdbb_default, count + nstreams + 1) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, count + nstreams + 1) Rsb();
rsb->rsb_type = rsb_union;
rsb->rsb_count = count;
rsb->rsb_stream = (UCHAR) union_node->nod_arg[e_uni_stream];
@ -4525,7 +4525,7 @@ static IRL indexed_relationship(TDBB tdbb, OPT opt, USHORT stream)
tail = opt->opt_rpt;
if (tail->opt_lower || tail->opt_upper) {
if (!relationship)
relationship = new(*tdbb->tdbb_default) irl();
relationship = FB_NEW(*tdbb->tdbb_default) irl();
if (idx->idx_flags & idx_unique) {
relationship->irl_unique = TRUE;
break;
@ -4580,7 +4580,7 @@ static STR make_alias(TDBB tdbb, CSB csb, csb_repeat * base_tail)
/* allocate a string block to hold the concatenated alias */
alias = new(*tdbb->tdbb_default, alias_length) str();
alias = FB_NEW_RPT(*tdbb->tdbb_default, alias_length) str();
alias->str_length = alias_length - 1;
/* now concatenate the individual aliases into the string block,
beginning at the end and copying back to the beginning */
@ -4666,7 +4666,7 @@ static RSB make_cross(TDBB tdbb, OPT opt, LLS stack)
}
csb = opt->opt_csb;
rsb = new(*tdbb->tdbb_default, count) Rsb();
rsb = FB_NEW_RPT(*tdbb->tdbb_default, count) Rsb();
rsb->rsb_type = rsb_cross;
rsb->rsb_count = count;
rsb->rsb_impure = CMP_impure(csb, sizeof(struct irsb));
@ -4710,7 +4710,7 @@ static NOD make_index_node(TDBB tdbb, REL relation, CSB csb, IDX * idx)
node = PAR_make_node(tdbb, e_idx_length);
node->nod_type = nod_index;
node->nod_count = 0;
retrieval = new(*tdbb->tdbb_default, idx->idx_count * 2) irb();
retrieval = FB_NEW_RPT(*tdbb->tdbb_default, idx->idx_count * 2) irb();
node->nod_arg[e_idx_retrieval] = (NOD) retrieval;
retrieval->irb_index = idx->idx_id;
MOVE_FAST(idx, &retrieval->irb_desc, sizeof(retrieval->irb_desc));

View File

@ -95,7 +95,7 @@ ModuleLoader::Module *ModuleLoader::loadModule(const Firebird::string& modPath)
init();
}
return new(*getDefaultMemoryPool()) DarwinModule(mod_handle);
return FB_NEW(*getDefaultMemoryPool()) DarwinModule(mod_handle);
}
DarwinModule::~DarwinModule()

View File

@ -53,7 +53,7 @@ ModuleLoader::Module *ModuleLoader::loadModule(const Firebird::string& modPath)
if (module == NULL)
return 0;
return new(*getDefaultMemoryPool()) DlfcnModule(module);
return FB_NEW(*getDefaultMemoryPool()) DlfcnModule(module);
}
DlfcnModule::~DlfcnModule()

View File

@ -57,7 +57,7 @@ const PosixDirItr& PosixDirItr::operator++()
PathUtils::dir_iterator *PathUtils::newDirItr(MemoryPool& p, const Firebird::string& path)
{
return new(p) PosixDirItr(path);
return FB_NEW(p) PosixDirItr(path);
}
void PathUtils::splitLastComponent(Firebird::string& path, Firebird::string& file,

View File

@ -40,7 +40,7 @@ ModuleLoader::Module *ModuleLoader::loadModule(const Firebird::string& modPath)
if (!module)
return 0;
return new(*getDefaultMemoryPool()) Win32Module(module);
return FB_NEW(*getDefaultMemoryPool()) Win32Module(module);
}
Win32Module::~Win32Module()

View File

@ -61,7 +61,7 @@ const PathUtils::dir_iterator& Win32DirItr::operator++()
PathUtils::dir_iterator *PathUtils::newDirItr(MemoryPool& p, const Firebird::string& path)
{
return new(p) Win32DirItr(path);
return FB_NEW(p) Win32DirItr(path);
}
void PathUtils::splitLastComponent(Firebird::string& path, Firebird::string& file,

View File

@ -601,7 +601,7 @@ static FIL setup_file(
/* Allocate file block and copy file name string */
file = new(*dbb->dbb_permanent, file_length + 1) fil();
file = FB_NEW_RPT(*dbb->dbb_permanent, file_length + 1) fil();
file->fil_desc = desc;
file->fil_length = file_length;
file->fil_max_page = -1;
@ -616,7 +616,7 @@ static FIL setup_file(
/* Build unique lock string for file and construct lock block */
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, file_length) lck();
dbb->dbb_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, file_length) lck();
lock->lck_type = LCK_database;
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
lock->lck_object = reinterpret_cast<blk*>(dbb);

View File

@ -715,7 +715,7 @@ SLONG PAG_attachment_id(void)
/* Take out lock on attachment id */
lock = attachment->att_id_lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock = attachment->att_id_lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock->lck_type = LCK_attachment;
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
lock->lck_parent = dbb->dbb_lock;
@ -1152,7 +1152,7 @@ void PAG_init(void)
dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
dbb->dbb_pcontrol = control = new(*dbb->dbb_permanent) pgc();
dbb->dbb_pcontrol = control = FB_NEW(*dbb->dbb_permanent) pgc();
control->pgc_bytes = dbb->dbb_page_size - OFFSETA(PIP, pip_bits);
control->pgc_ppp = control->pgc_bytes * 8;
control->pgc_tpt =

View File

@ -25,7 +25,7 @@
* 2001.07.28: Added parse code for blr_skip to support LIMIT.
*/
/*
$Id: par.cpp,v 1.11 2002-09-10 18:34:00 skidder Exp $
$Id: par.cpp,v 1.12 2002-09-25 17:12:10 skidder Exp $
*/
#include "firebird.h"
@ -365,7 +365,7 @@ NOD PAR_gen_field(TDBB tdbb, USHORT stream, USHORT id)
SET_TDBB(tdbb);
node = new(*tdbb->tdbb_default, e_fld_length) nod();
node = FB_NEW_RPT(*tdbb->tdbb_default, e_fld_length) nod();
node->nod_type = nod_field;
node->nod_arg[e_fld_id] = (NOD) (SLONG) id;
node->nod_arg[e_fld_stream] = (NOD) (SLONG) stream;
@ -499,7 +499,7 @@ NOD PAR_make_node(TDBB tdbb, int size)
SET_TDBB(tdbb);
node = new(*tdbb->tdbb_default, size) nod();
node = FB_NEW_RPT(*tdbb->tdbb_default, size) nod();
node->nod_count = size;
return node;
@ -783,7 +783,7 @@ static XCP par_condition(TDBB tdbb, CSB * csb)
/* allocate a node to represent the conditions list */
exception_list = new(*tdbb->tdbb_default, 1) xcp();
exception_list = FB_NEW_RPT(*tdbb->tdbb_default, 1) xcp();
exception_list->xcp_count = 1;
code_type = BLR_BYTE;
switch (code_type) {
@ -850,7 +850,7 @@ static XCP par_conditions(TDBB tdbb, CSB * csb)
/* allocate a node to represent the conditions list */
n = BLR_WORD;
exception_list = new(*tdbb->tdbb_default, n) xcp();
exception_list = FB_NEW_RPT(*tdbb->tdbb_default, n) xcp();
exception_list->xcp_count = n;
for (i = 0; i < n; i++) {
code_type = BLR_BYTE;
@ -977,7 +977,7 @@ static void par_dependency(
node->nod_arg[e_dep_field] = field_node = PAR_make_node(tdbb, 1);
field_node->nod_type = nod_literal;
length = strlen(field_name);
string = new(*tdbb->tdbb_default, length) str();
string = FB_NEW_RPT(*tdbb->tdbb_default, length) str();
string->str_length = length;
strcpy(reinterpret_cast < char *>(string->str_data), field_name);
field_node->nod_arg[0] = (NOD) string->str_data;
@ -1913,7 +1913,7 @@ static NOD par_relation(
id = BLR_WORD;
if (operator_ == blr_rid2) {
length = BLR_PEEK;
alias_string = new(*tdbb->tdbb_default, length + 1) str();
alias_string = FB_NEW_RPT(*tdbb->tdbb_default, length + 1) str();
alias_string->str_length = length;
par_name(csb, reinterpret_cast < char *>(alias_string->str_data));
}
@ -1926,7 +1926,7 @@ static NOD par_relation(
par_name(csb, name);
if (operator_ == blr_relation2) {
length = BLR_PEEK;
alias_string = new(*tdbb->tdbb_default, length + 1) str();
alias_string = FB_NEW_RPT(*tdbb->tdbb_default, length + 1) str();
alias_string->str_length = length;
par_name(csb, reinterpret_cast < char *>(alias_string->str_data));
}

View File

@ -101,7 +101,7 @@ void PluginManager::loadAllPlugins()
// as defined by the host os, then by all means load it!
if (!alreadyLoaded && ModuleLoader::isLoadableModule(**dirItr))
{
Module *mod = new(*getDefaultMemoryPool()) PluginModule(**dirItr,
Module *mod = FB_NEW(*getDefaultMemoryPool()) PluginModule(**dirItr,
ModuleLoader::loadModule(**dirItr));
if (moduleList)
{
@ -143,13 +143,13 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::string& n
if (ModuleLoader::isLoadableModule(checkPath))
{
return new(*getDefaultMemoryPool()) PluginModule(checkPath,
return FB_NEW(*getDefaultMemoryPool()) PluginModule(checkPath,
ModuleLoader::loadModule(checkPath));
}
ModuleLoader::doctorModuleExtention(checkPath);
if (ModuleLoader::isLoadableModule(checkPath))
{
return new(*getDefaultMemoryPool()) PluginModule(checkPath,
return FB_NEW(*getDefaultMemoryPool()) PluginModule(checkPath,
ModuleLoader::loadModule(checkPath));
}
}
@ -180,14 +180,14 @@ PluginManager::Module *PluginManager::loadPluginModule(const Firebird::string& n
// OK, the module has the correct prefix path, lets try to load it.
if (ModuleLoader::isLoadableModule(name))
{
return new(*getDefaultMemoryPool()) PluginModule(name,
return FB_NEW(*getDefaultMemoryPool()) PluginModule(name,
ModuleLoader::loadModule(name));
}
checkPath = name;
ModuleLoader::doctorModuleExtention(checkPath);
if (ModuleLoader::isLoadableModule(checkPath))
{
return new(*getDefaultMemoryPool()) PluginModule(checkPath,
return FB_NEW(*getDefaultMemoryPool()) PluginModule(checkPath,
ModuleLoader::loadModule(checkPath));
}
}

View File

@ -1053,7 +1053,7 @@ USHORT activate_shadow, SLONG * timestamp, SLONG page_no, PAG page)
else if (!WALRS_handle)
ERR_post(gds_wal_failure, 0);
string = new(*dbb->dbb_permanent, MAX_WALBUFLEN) str();
string = FB_NEW_RPT(*dbb->dbb_permanent, MAX_WALBUFLEN) str();
wal_buff = (UCHAR *) string->str_data;
while (TRUE) {

View File

@ -300,7 +300,7 @@ LCK RLCK_record_locking(REL relation)
tdbb = GET_THREAD_DATA;
dbb = GET_DBB;
lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock->lck_parent = dbb->dbb_lock;
lock->lck_dbb = dbb;
lock->lck_attachment = tdbb->tdbb_attachment;
@ -555,7 +555,7 @@ void RLCK_signal_refresh(TRA transaction)
/* allocate a local lock */
local_lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
local_lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) lck();
local_lock->lck_dbb = dbb;
local_lock->lck_attachment = tdbb->tdbb_attachment;
local_lock->lck_length = sizeof(SLONG);
@ -797,7 +797,7 @@ static LCK allocate_record_lock(TRA transaction, RPB * rpb)
if (!rpb->rpb_record)
ERR_post(gds_no_cur_rec, 0);
/* allocate a lock block for the record lock */
lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock->lck_dbb = dbb;
lock->lck_attachment = attachment;
lock->lck_object = reinterpret_cast<blk*>(dbb);
@ -850,7 +850,7 @@ static LCK allocate_relation_lock(MemoryPool* pool, REL relation)
LCK lock;
tdbb = GET_THREAD_DATA;
dbb = tdbb->tdbb_database;
lock = new(*pool, sizeof(SLONG)) lck();
lock = FB_NEW_RPT(*pool, sizeof(SLONG)) lck();
lock->lck_dbb = dbb;
lock->lck_attachment = tdbb->tdbb_attachment;
lock->lck_length = sizeof(SLONG);

View File

@ -424,7 +424,7 @@ DSC *RNG_begin(NOD node, VLU impure)
/* allocate the range block and move the event name into it */
refresh_range = new(*tdbb->tdbb_default, p - event_name + 1) rng();
refresh_range = FB_NEW_RPT(*tdbb->tdbb_default, p - event_name + 1) rng();
refresh_range->rng_event_length = p - event_name;
strcpy(refresh_range->rng_event, event_name);

View File

@ -20,7 +20,7 @@
* All Rights Reserved.
* Contributor(s): ______________________________________.
*
* $Id: rse.cpp,v 1.7 2002-08-22 08:20:27 dimitr Exp $
* $Id: rse.cpp,v 1.8 2002-09-25 17:12:11 skidder Exp $
*
* 2001.07.28: John Bellardo: Implemented rse_skip and made rse_first work with
* seekable streams.
@ -2025,7 +2025,7 @@ static BOOLEAN get_procedure(TDBB tdbb,
if (!impure->irsb_message)
{
size = msg_format->fmt_length + ALIGNMENT;
impure->irsb_message = new(*tdbb->tdbb_default, size) str();
impure->irsb_message = FB_NEW_RPT(*tdbb->tdbb_default, size) str();
impure->irsb_message->str_length = size;
}
om =
@ -2035,7 +2035,7 @@ static BOOLEAN get_procedure(TDBB tdbb,
if (!rpb->rpb_record) {
record = rpb->rpb_record =
new(*tdbb->tdbb_default, rec_format->fmt_length) rec();
FB_NEW_RPT(*tdbb->tdbb_default, rec_format->fmt_length) rec();
record->rec_format = rec_format;
record->rec_length = rec_format->fmt_length;
}
@ -3622,11 +3622,11 @@ static void save_record(TDBB tdbb, RPB * rpb)
delete rec_copy;
}
else
rpb->rpb_copy = rpb_copy = new(*tdbb->tdbb_default) srpb();
rpb->rpb_copy = rpb_copy = FB_NEW(*tdbb->tdbb_default) srpb();
MOVE_FAST(rpb, rpb_copy->srpb_rpb, sizeof(struct rpb));
rpb_copy->srpb_rpb->rpb_record = rec_copy =
new(*tdbb->tdbb_default, size) rec();
FB_NEW_RPT(*tdbb->tdbb_default, size) rec();
rec_copy->rec_length = size;
rec_copy->rec_format = record->rec_format;
@ -3681,7 +3681,7 @@ static void write_merge_block(TDBB tdbb, MFB mfb, ULONG block)
SFB sfb_;
if (!(sfb_ = mfb->mfb_sfb)) {
sfb_ = mfb->mfb_sfb = new(*getDefaultMemoryPool()) sfb;
sfb_ = mfb->mfb_sfb = FB_NEW(*getDefaultMemoryPool()) sfb;
}
if (!sfb_->sfb_file_name) {
TEXT file_name[128];

View File

@ -766,7 +766,7 @@ void SBM_set(TDBB tdbb, SBM * bitmap, SLONG number)
SET_TDBB(tdbb);
if (!(vector = *bitmap)) {
*bitmap = vector = new(*tdbb->tdbb_default) sbm(*tdbb->tdbb_default, 5);
*bitmap = vector = FB_NEW(*tdbb->tdbb_default) sbm(*tdbb->tdbb_default, 5);
vector->sbm_type = SBM_ROOT;
vector->sbm_count = 5;
vector->sbm_state = SBM_SINGULAR;
@ -811,7 +811,7 @@ void SBM_set(TDBB tdbb, SBM * bitmap, SLONG number)
if ( (bucket = tdbb->tdbb_default->plb_buckets) )
tdbb->tdbb_default->plb_buckets = bucket->sbm_next;
else {
bucket = new(*tdbb->tdbb_default)
bucket = FB_NEW(*tdbb->tdbb_default)
sbm(*tdbb->tdbb_default, BUNCH_BUCKET);
bucket->sbm_pool = tdbb->tdbb_default;
}
@ -845,7 +845,7 @@ void SBM_set(TDBB tdbb, SBM * bitmap, SLONG number)
clear_segment(segment);
}
else {
segment = new(*tdbb->tdbb_default) bms();
segment = FB_NEW(*tdbb->tdbb_default) bms();
segment->bms_pool = tdbb->tdbb_default;
}
vector->sbm_segments[slot] = segment;

View File

@ -484,7 +484,7 @@ SCL SCL_get_class(/* INOUT */ TEXT* string)
/* Class isn't known. So make up a new security class block */
s_class = new(*dbb->dbb_permanent, p - name) scl();
s_class = FB_NEW_RPT(*dbb->dbb_permanent, p - name) scl();
p = name;
q = s_class->scl_name;
while ( (*q++ = *p++) )
@ -759,7 +759,7 @@ void SCL_init(BOOLEAN create,
length = strlen(name) + strlen(role_name) + strlen(project) +
strlen(organization) + 4; /* for the terminating nulls */
tdbb->tdbb_attachment->att_user = user = new(*dbb->dbb_permanent, length) usr();
tdbb->tdbb_attachment->att_user = user = FB_NEW_RPT(*dbb->dbb_permanent, length) usr();
p = user->usr_data;
user->usr_user_name = save_string(name, &p);
user->usr_project_name = save_string(project, &p);
@ -1019,7 +1019,7 @@ static BOOLEAN check_user_group(CONST TEXT* acl,
try {
buffer = new(*dbb->dbb_permanent, *length_ptr) str();
buffer = FB_NEW_RPT(*dbb->dbb_permanent, *length_ptr) str();
n = 0;
if ( (l = *acl++) )
@ -1141,7 +1141,7 @@ static SLONG compute_access(TDBB tdbb,
try {
/* Get some space that's not off the stack */
str_buffer = new(*dbb->dbb_permanent, BLOB_BUFFER_SIZE) str();
str_buffer = FB_NEW_RPT(*dbb->dbb_permanent, BLOB_BUFFER_SIZE) str();
buffer = (TEXT*) str_buffer->str_data;

View File

@ -322,7 +322,7 @@ void SDW_check(void)
}
if (SDW_check_conditional()) {
if (SDW_lck_update((SLONG) 0)) {
lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock->lck_dbb = dbb;
lock->lck_attachment = tdbb->tdbb_attachment;
lock->lck_length = sizeof(SLONG);
@ -596,7 +596,7 @@ void SDW_init(USHORT activate, USHORT delete_, SBM sbm_rec)
/* set up the lock block for synchronizing addition of new shadows */
key_length = sizeof(header->hdr_shadow_count);
dbb->dbb_shadow_lock = lock = new(*dbb->dbb_permanent, key_length) lck();
dbb->dbb_shadow_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, key_length) lck();
lock->lck_type = LCK_shadow;
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
lock->lck_parent = dbb->dbb_lock;
@ -1197,7 +1197,7 @@ static SDW allocate_shadow(
dbb = GET_DBB;
shadow = new(*dbb->dbb_permanent) sdw();
shadow = FB_NEW(*dbb->dbb_permanent) sdw();
shadow->sdw_file = shadow_file;
shadow->sdw_number = shadow_number;
if (file_flags & FILE_manual)

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: sort.cpp,v 1.11 2002-09-17 05:58:36 eku Exp $
* $Id: sort.cpp,v 1.12 2002-09-25 17:12:11 skidder Exp $
*
* 2001-09-24 SJL - Temporary fix for large sort file bug
*
@ -1835,7 +1835,7 @@ static ULONG find_file_space(SCB scb, ULONG size, SFB * ret_sfb)
// dimitr: allocate sort memory
#ifdef SORT_MEM
sfb->sfb_mem = new (*getDefaultMemoryPool()) SortMem(sfb, size);
sfb->sfb_mem = FB_NEW (*getDefaultMemoryPool()) SortMem(sfb, size);
#endif
}

View File

@ -204,7 +204,7 @@ void SortMem::allocate(long size)
// Allocate block in virtual memory
try
{
block = new (*getDefaultMemoryPool())
block = FB_NEW (*getDefaultMemoryPool())
MemoryBlock(tail, smart_size);
mem_allocated = true;
}
@ -218,7 +218,7 @@ void SortMem::allocate(long size)
smart_size = size;
try
{
block = new (*getDefaultMemoryPool())
block = FB_NEW (*getDefaultMemoryPool())
MemoryBlock(tail, smart_size);
mem_allocated = true;
}
@ -236,7 +236,7 @@ void SortMem::allocate(long size)
if (!mem_allocated)
{
// Allocate block on disk
block = new (*getDefaultMemoryPool())
block = FB_NEW (*getDefaultMemoryPool())
FileBlock(tail, size, internal, file_size);
physical_size += size;
// We've just allocated some file storage

View File

@ -464,7 +464,7 @@ USHORT SQZ_length(TDBB tdbb, SCHAR* data, int length, DCC dcc)
}
else
{
dcc->dcc_next = new(*tdbb->tdbb_default) Dcc();
dcc->dcc_next = FB_NEW(*tdbb->tdbb_default) Dcc();
dcc = dcc->dcc_next;
dcc->dcc_pool = tdbb->tdbb_default;
}
@ -502,7 +502,7 @@ USHORT SQZ_length(TDBB tdbb, SCHAR* data, int length, DCC dcc)
}
else
{
dcc->dcc_next = new(*tdbb->tdbb_default) Dcc();
dcc->dcc_next = FB_NEW(*tdbb->tdbb_default) Dcc();
dcc = dcc->dcc_next;
dcc->dcc_pool = tdbb->tdbb_default;
}

View File

@ -617,7 +617,7 @@ SVC SVC_attach(USHORT service_length,
we cannot use the JRD allocator. */
// service = (SVC) gds__alloc((SLONG) (sizeof(struct svc)));
service = new(*getDefaultMemoryPool()) svc;
service = FB_NEW(*getDefaultMemoryPool()) svc;
/* FREE: by exception handler */
if (!service)
ERR_post(isc_virmemexh, 0);

View File

@ -246,7 +246,7 @@ int TPC_snapshot_state(TDBB tdbb, SLONG number)
// receiver of this (ptr) checks its type.
// Please review this. This lock has _nothing_ to do in the
// permamnent pool!
std::auto_ptr<lck> temp_lock(new(*dbb->dbb_permanent, 0) lck);
std::auto_ptr<lck> temp_lock(FB_NEW_RPT(*dbb->dbb_permanent, 0) lck);
//temp_lock.blk_type = type_lck;
temp_lock->lck_dbb = dbb;
@ -365,7 +365,7 @@ static TPC allocate_tpc(TDBB tdbb, ULONG base)
/* allocate a TIP cache block with enough room for
all desired transactions */
tip_cache = new(*dbb->dbb_permanent, trans_per_tip / 4) tpc();
tip_cache = FB_NEW_RPT(*dbb->dbb_permanent, trans_per_tip / 4) tpc();
tip_cache->tpc_base = base;
return tip_cache;

View File

@ -174,7 +174,7 @@ BOOLEAN TRA_active_transactions(TDBB tdbb, DBB dbb)
base = oldest & ~TRA_MASK;
trans = new(*dbb->dbb_permanent, (number - base + TRA_MASK) / 4) tra();
trans = FB_NEW_RPT(*dbb->dbb_permanent, (number - base + TRA_MASK) / 4) tra();
/* Build transaction bitmap to scan for active transactions. */
@ -735,7 +735,7 @@ void TRA_init(TDBB tdbb)
dbb = tdbb->tdbb_database;
CHECK_DBB(dbb);
dbb->dbb_sys_trans = trans = new(*dbb->dbb_permanent, 0) tra();
dbb->dbb_sys_trans = trans = FB_NEW_RPT(*dbb->dbb_permanent, 0) tra();
trans->tra_flags |= TRA_system | TRA_ignore_limbo;
trans->tra_pool = dbb->dbb_permanent;
}
@ -822,7 +822,7 @@ void TRA_post_resources(TDBB tdbb, TRA transaction, RSC resources)
tra_rsc =
tra_rsc->rsc_next) if (rsc->rsc_id == tra_rsc->rsc_id) break;
if (!tra_rsc) {
new_rsc = new(*tdbb->tdbb_default) Rsc();
new_rsc = FB_NEW(*tdbb->tdbb_default) Rsc();
new_rsc->rsc_next = transaction->tra_resources;
transaction->tra_resources = new_rsc;
new_rsc->rsc_id = rsc->rsc_id;
@ -1007,8 +1007,8 @@ TRA TRA_reconnect(TDBB tdbb, UCHAR * id, USHORT length)
ERR_post(isc_read_only_database, 0);
tdbb->tdbb_default = new(*dbb->dbb_permanent) JrdMemoryPool;
trans = new(*tdbb->tdbb_default, 0) tra();
tdbb->tdbb_default = FB_NEW(*dbb->dbb_permanent) JrdMemoryPool;
trans = FB_NEW_RPT(*tdbb->tdbb_default, 0) tra();
trans->tra_pool = tdbb->tdbb_default;
trans->tra_number = gds__vax_integer(id, length);
trans->tra_flags |= TRA_prepared | TRA_reconnected | TRA_write;
@ -1448,8 +1448,8 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
transaction block first, sieze relation locks, the go ahead and
make up the real transaction block. */
tdbb->tdbb_default = new(*dbb->dbb_permanent) JrdMemoryPool;
temp = new(*tdbb->tdbb_default, 0) tra;
tdbb->tdbb_default = FB_NEW(*dbb->dbb_permanent) JrdMemoryPool;
temp = FB_NEW_RPT(*tdbb->tdbb_default, 0) tra;
temp->tra_pool = tdbb->tdbb_default;
transaction_options(tdbb, temp, reinterpret_cast < UCHAR * >(tpb),
tpb_length);
@ -1496,9 +1496,9 @@ TRA TRA_start(TDBB tdbb, int tpb_length, SCHAR * tpb)
base = oldest & ~TRA_MASK;
if (temp->tra_flags & TRA_read_committed)
trans = new(*tdbb->tdbb_default, 0) tra;
trans = FB_NEW_RPT(*tdbb->tdbb_default, 0) tra;
else {
trans = new(*tdbb->tdbb_default, (number - base + TRA_MASK) / 4) tra;
trans = FB_NEW_RPT(*tdbb->tdbb_default, (number - base + TRA_MASK) / 4) tra;
}
trans->tra_pool = temp->tra_pool;
@ -1955,7 +1955,7 @@ LCK TRA_transaction_lock(TDBB tdbb, BLK object)
SET_TDBB(tdbb);
dbb = tdbb->tdbb_database;
lock = new(*tdbb->tdbb_default, sizeof(SLONG)) lck();
lock = FB_NEW_RPT(*tdbb->tdbb_default, sizeof(SLONG)) lck();
lock->lck_type = LCK_tra;
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);
lock->lck_length = sizeof(SLONG);
@ -2242,7 +2242,7 @@ static void compute_oldest_retaining(
/* Get a commit retaining lock, if not present. */
if (!(lock = dbb->dbb_retaining_lock)) {
lock = new(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) lck();
lock->lck_dbb = dbb;
lock->lck_type = LCK_retaining;
lock->lck_owner_handle = LCK_get_owner_handle(tdbb, lock->lck_type);

View File

@ -978,7 +978,7 @@ static FIL setup_file(
/* Allocate file block and copy file name string */
file = new(*dbb->dbb_permanent, file_length + 1) fil();
file = FB_NEW_RPT(*dbb->dbb_permanent, file_length + 1) fil();
file->fil_desc = desc;
file->fil_length = file_length;
file->fil_max_page = -1;
@ -1012,7 +1012,7 @@ static FIL setup_file(
l = p - lock_string;
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, l) lck();
dbb->dbb_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, l) lck();
lock->lck_type = LCK_database;
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
lock->lck_object = reinterpret_cast<blk*>(dbb);

View File

@ -701,7 +701,7 @@ BOOLEAN VAL_validate(TDBB tdbb, USHORT switches)
old_pool = tdbb->tdbb_default;
val_pool = 0;
tdbb->tdbb_default = val_pool = new(*dbb->dbb_permanent) JrdMemoryPool;
tdbb->tdbb_default = val_pool = FB_NEW(*dbb->dbb_permanent) JrdMemoryPool;
control.vdr_page_bitmap = NULL;
control.vdr_flags = 0;

View File

@ -53,7 +53,7 @@ public:
{
}
static fmt* newFmt(MemoryPool& p, int len = 0)
{ return new(p) fmt(p, len); }
{ return FB_NEW(p) fmt(p, len); }
USHORT fmt_length;
USHORT fmt_count;

View File

@ -2149,7 +2149,7 @@ REC VIO_record(TDBB tdbb, register RPB * rpb, FMT format, JrdMemoryPool *pool)
if (!(record = rpb->rpb_record)) {
if (!pool)
pool = dbb->dbb_permanent;
record = rpb->rpb_record = new(*pool, format->fmt_length) rec;
record = rpb->rpb_record = FB_NEW_RPT(*pool, format->fmt_length) rec;
record->rec_length = format->fmt_length;
}
else if (record->rec_length < format->fmt_length) {
@ -2160,7 +2160,7 @@ REC VIO_record(TDBB tdbb, register RPB * rpb, FMT format, JrdMemoryPool *pool)
format->fmt_length);
else
{
record = new(*MemoryPool::blk_pool(record), format->fmt_length) rec;
record = FB_NEW_RPT(*MemoryPool::blk_pool(record), format->fmt_length) rec;
memcpy(record, rpb->rpb_record, sizeof(rec) + sizeof(SCHAR)*rpb->rpb_record->rec_length);
delete rpb->rpb_record;
rpb->rpb_record = record;
@ -2201,7 +2201,7 @@ void VIO_start_save_point(TDBB tdbb, TRA transaction)
if ( (sav_point = transaction->tra_save_free) )
transaction->tra_save_free = sav_point->sav_next;
else
sav_point = new(*transaction->tra_pool) sav();
sav_point = FB_NEW(*transaction->tra_pool) sav();
sav_point->sav_number = ++transaction->tra_save_point_number;
sav_point->sav_next = transaction->tra_save_point;
@ -3253,7 +3253,7 @@ static void THREAD_ROUTINE garbage_collector(DBB dbb)
/* Pseudo attachment needed for lock owner identification. */
tdbb->tdbb_attachment = new(*dbb->dbb_permanent) att();
tdbb->tdbb_attachment = FB_NEW(*dbb->dbb_permanent) att();
tdbb->tdbb_attachment->att_database = dbb;
tdbb->tdbb_attachment->att_flags = ATT_garbage_collector;
@ -3527,7 +3527,7 @@ static SAV get_free_save_point_block(TRA transaction)
if ( (sav_point = transaction->tra_save_free) )
transaction->tra_save_free = sav_point->sav_next;
else
sav_point = new(*transaction->tra_pool) sav();
sav_point = FB_NEW(*transaction->tra_pool) sav();
return sav_point;
}
@ -4158,7 +4158,7 @@ static REC replace_gc_record(REL relation, REC * gc_record, USHORT length)
for (rec_ptr = vector->begin(), end = vector->end(); rec_ptr < end;
++rec_ptr)
if (*rec_ptr == *gc_record) {
temp = new(*MemoryPool::blk_pool(*gc_record), length) rec;
temp = FB_NEW_RPT(*MemoryPool::blk_pool(*gc_record), length) rec;
memcpy(temp, *rec_ptr, sizeof(rec) + sizeof(SCHAR)*(*gc_record)->rec_length);
delete *rec_ptr;
*rec_ptr = temp;
@ -4455,7 +4455,7 @@ static void verb_post(
if ( (action = transaction->tra_save_point->sav_verb_free) )
transaction->tra_save_point->sav_verb_free = action->vct_next;
else
action = new(*tdbb->tdbb_default) vct();
action = FB_NEW(*tdbb->tdbb_default) vct();
action->vct_next = transaction->tra_save_point->sav_verb_actions;
transaction->tra_save_point->sav_verb_actions = action;
action->vct_relation = rpb->rpb_relation;
@ -4468,7 +4468,7 @@ static void verb_post(
savepoint hasn't seen this record before. */
SBM_set(tdbb, &action->vct_undo, rpb->rpb_number);
data = new(*tdbb->tdbb_default, old_data->rec_length) rec();
data = FB_NEW_RPT(*tdbb->tdbb_default, old_data->rec_length) rec();
data->rec_number = rpb->rpb_number;
data->rec_length = old_data->rec_length;
data->rec_format = old_data->rec_format;
@ -4484,7 +4484,7 @@ static void verb_post(
and this savepoint hasn't seen this record before. */
SBM_set(tdbb, &action->vct_undo, rpb->rpb_number);
data = new(*tdbb->tdbb_default, 1) rec;
data = FB_NEW_RPT(*tdbb->tdbb_default, 1) rec;
data->rec_number = rpb->rpb_number;
data->rec_length = 0;
if (new_ver)
@ -4513,7 +4513,7 @@ static void verb_post(
undo data. */
SBM_set(tdbb, &action->vct_undo, rpb->rpb_number);
data = new(*tdbb->tdbb_default, 1) rec();
data = FB_NEW_RPT(*tdbb->tdbb_default, 1) rec();
data->rec_number = rpb->rpb_number;
data->rec_length = 0;
data->rec_flags |= (REC_same_tx | REC_new_version);

View File

@ -827,7 +827,7 @@ static FIL setup_file(
/* Allocate file block and move in file name */
file = new(dbb->dbb_permanent, file_length + 1) fil();
file = FB_NEW_RPT(dbb->dbb_permanent, file_length + 1) fil();
file->fil_desc = chan;
file->fil_length = file_length;
file->fil_max_page = -1;
@ -875,7 +875,7 @@ static FIL setup_file(
while (--l);
l = p - lock_id;
dbb->dbb_lock = lock = new(dbb->dbb_permanent, l) lck();
dbb->dbb_lock = lock = FB_NEW_RPT(dbb->dbb_permanent, l) lck();
lock->lck_type = LCK_database;
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
lock->lck_object = reinterpret_cast<blk*>(dbb);

View File

@ -665,7 +665,7 @@ static FIL setup_file(
/* Allocate file block and copy file name string */
file = new(dbb->dbb_permanent, file_length + 1) fil();
file = FB_NEW_RPT(dbb->dbb_permanent, file_length + 1) fil();
file->fil_desc = desc;
file->fil_length = file_length;
file->fil_max_page = -1;
@ -687,7 +687,7 @@ static FIL setup_file(
l = file_length;
lock_string = file_name;
dbb->dbb_lock = lock = new(dbb->dbb_permanent, l) lck();
dbb->dbb_lock = lock = FB_NEW_RPT(dbb->dbb_permanent, l) lck();
lock->lck_type = LCK_database;
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
lock->lck_object = reinterpret_cast<blk*>(dbb);

View File

@ -1058,7 +1058,7 @@ static FIL setup_file(DBB dbb,
/* Allocate file block and copy file name string */
file = new(*dbb->dbb_permanent, file_length + 1) fil;
file = FB_NEW_RPT(*dbb->dbb_permanent, file_length + 1) fil;
file->fil_desc = reinterpret_cast<SLONG>(desc);
file->fil_force_write_desc =
reinterpret_cast<SLONG>(INVALID_HANDLE_VALUE);
@ -1106,7 +1106,7 @@ static FIL setup_file(DBB dbb,
l = p - lock_string;
dbb->dbb_lock = lock = new(*dbb->dbb_permanent, l) lck;
dbb->dbb_lock = lock = FB_NEW_RPT(*dbb->dbb_permanent, l) lck;
lock->lck_type = LCK_database;
lock->lck_owner_handle = LCK_get_owner_handle(NULL_TDBB, lock->lck_type);
lock->lck_object = reinterpret_cast<blk*>(dbb);

View File

@ -932,7 +932,7 @@ static SCHAR *alloc( SLONG size)
TDBA tddba = GET_THREAD_DATA;
block = p = new(*getDefaultMemoryPool()) SCHAR[size];
block = p = FB_NEW(*getDefaultMemoryPool()) SCHAR[size];
if (!p) {
/* NOMEM: return error */
dba_error(31, 0, 0, 0, 0, 0);
@ -942,7 +942,7 @@ static SCHAR *alloc( SLONG size)
*p++ = 0;
while (--size);
mem* mem_list = new(*getDefaultMemoryPool()) mem;
mem* mem_list = FB_NEW(*getDefaultMemoryPool()) mem;
if (!mem_list) {
/* NOMEM: return error */
dba_error(31, 0, 0, 0, 0, 0);
@ -1361,7 +1361,7 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
db_error(errno);
}
file_list = new(*getDefaultMemoryPool()) open_files;
file_list = FB_NEW(*getDefaultMemoryPool()) open_files;
if (!file_list) {
/* NOMEM: return error */
dba_error(31, 0, 0, 0, 0, 0);
@ -1545,7 +1545,7 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
}
#ifdef SUPERSERVER
open_files* file_list = new(*getDefaultMemoryPool()) open_files;
open_files* file_list = FB_NEW(*getDefaultMemoryPool()) open_files;
if (!file_list) {
/* NOMEM: return error */
dba_error(31, 0, 0, 0, 0, 0);
@ -1734,7 +1734,7 @@ static DBA_FIL db_open( UCHAR * file_name, USHORT file_length)
}
#ifdef SUPERSERVER
file_list = new(*getDefaultMemoryPool()) open_files;
file_list = FB_NEW(*getDefaultMemoryPool()) open_files;
if (!file_list) {
/* NOMEM: return error */
dba_error(31, 0, 0, 0, 0, 0);