summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-12 00:25:20 +0000
committermarina <marina@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-12 00:25:20 +0000
commit671b70493bd685f6c4e2e5264eb8c201b893ab41 (patch)
treeac8a93daf2f860dfdb89ea117115d6ec9eafb0d7
parente8b6541f11b118a26c624938553835a68a75456d (diff)
downloadATCD-671b70493bd685f6c4e2e5264eb8c201b893ab41.tar.gz
changed the use of variable <index> to <context_index> to prevent name conflict with macro called index.
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp22
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index_T.cpp12
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp12
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h4
4 files changed, 30 insertions, 20 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
index 6c6a3d5b992..d2f1e0d1829 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Naming_Utils.cpp
@@ -106,19 +106,29 @@ TAO_Naming_Server::init_new_naming (CORBA::ORB_ptr orb,
{
if (persistence_location != 0)
{
- TAO_Persistent_Context_Index<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> *index =
+ // 1. Please do not change to ACE_NEW_RETURN, 2. This
+ // needs to be cleaned up (currently a memory leak) when
+ // TAO_Naming_Server dies.
+ TAO_Persistent_Context_Index<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> *context_index =
new TAO_Persistent_Context_Index<ACE_MMAP_MEMORY_POOL, ACE_SYNCH_MUTEX> (orb,
poa);
- if (index->open (persistence_location) == -1)
+
+ if (context_index == 0)
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+
+ if (context_index->open (persistence_location) == -1)
ACE_DEBUG ((LM_DEBUG,
- "index->open failed"));
+ "context_index->open failed"));
- if (index->init () == -1)
+ if (context_index->init () == -1)
ACE_DEBUG ((LM_DEBUG,
- "index->init failed"));
+ "context_index->init failed"));
// Set the ior and objref to the root naming context.
- this->naming_service_ior_= index->root_ior ();
+ this->naming_service_ior_= context_index->root_ior ();
CORBA::Object_var obj =
orb->string_to_object (this->naming_service_ior_.in (),
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index_T.cpp b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index_T.cpp
index ea21384647f..0a703a0d43a 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index_T.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Context_Index_T.cpp
@@ -325,24 +325,24 @@ TAO_Persistent_Context_Index<ACE_MEM_POOL_2, ACE_LOCK>::create_index (void)
-1);
#endif /* ACE_LACKS_ACCESS */
- void *index = 0;
+ void *context_index = 0;
// This is the easy case since if we find the Context Index Map
// we know it's already initialized.
- if (this->allocator_->find (TAO_NAME_CONTEXTS_INDEX, index) == 0)
- this->index_ = (INDEX *) index;
+ if (this->allocator_->find (TAO_NAME_CONTEXTS_INDEX, context_index) == 0)
+ this->index_ = (INDEX *) context_index;
else
{
size_t index_size = sizeof (INDEX);
- index = this->allocator_->malloc (index_size);
+ context_index = this->allocator_->malloc (index_size);
// Initialize the map into its memory location (e.g., shared memory).
ACE_NEW_RETURN (this->index_,
- (index) INDEX (this->allocator_),
+ (context_index) INDEX (this->allocator_),
-1);
- if (this->allocator_->bind (TAO_NAME_CONTEXTS_INDEX, index) == -1)
+ if (this->allocator_->bind (TAO_NAME_CONTEXTS_INDEX, context_index) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "create_index\n"), -1);
}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp
index d613b95f5d9..3d80a223ede 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.cpp
@@ -18,13 +18,13 @@
ACE_RCSID(Naming, Persistent_Naming_Context, "$Id:")
TAO_Persistent_Naming_Context::TAO_Persistent_Naming_Context(TAO_Naming_Context *interface,
- TAO_Index *index,
+ TAO_Index *context_index,
PortableServer::POA_ptr poa,
const char *poa_id,
size_t default_hash_table_size)
: counter_ (0),
- context_ (index->orb ()),
- index_ (index),
+ context_ (context_index->orb ()),
+ index_ (context_index),
poa_ (PortableServer::POA::_duplicate (poa)),
poa_id_ (poa_id),
lock_ (0),
@@ -42,14 +42,14 @@ TAO_Persistent_Naming_Context::TAO_Persistent_Naming_Context(TAO_Naming_Context
}
TAO_Persistent_Naming_Context::TAO_Persistent_Naming_Context(TAO_Naming_Context *interface,
- TAO_Index *index,
+ TAO_Index *context_index,
PortableServer::POA_ptr poa,
const char *poa_id,
HASH_MAP *map,
ACE_UINT32 *counter)
: counter_ (counter),
- context_ (index->orb ()),
- index_ (index),
+ context_ (context_index->orb ()),
+ index_ (context_index),
poa_ (PortableServer::POA::_duplicate (poa)),
poa_id_ (poa_id),
lock_ (0),
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h
index 643073fb466..42145b8e3c1 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/Persistent_Naming_Context.h
@@ -37,14 +37,14 @@ public:
// = Initialization and termination methods.
TAO_Persistent_Naming_Context (TAO_Naming_Context *interface,
- TAO_Index *index,
+ TAO_Index *context_index,
PortableServer::POA_ptr poa,
const char *poa_id,
size_t default_hash_table_size = ACE_DEFAULT_MAP_SIZE);
// Default constructor. Sets the implementation pointer of the interface.
TAO_Persistent_Naming_Context (TAO_Naming_Context *interface,
- TAO_Index *index,
+ TAO_Index *context_index,
PortableServer::POA_ptr poa,
const char *poa_id,
HASH_MAP * map,