summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ace/Parse_Node.cpp22
-rw-r--r--ace/Service_Config.cpp10
-rw-r--r--ace/Service_Object.h6
-rw-r--r--ace/Service_Repository.cpp7
-rw-r--r--ace/Svc_Conf.y52
-rw-r--r--ace/Svc_Conf_y.cpp88
6 files changed, 121 insertions, 64 deletions
diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp
index 0c3549126e7..8a8c1d25578 100644
--- a/ace/Parse_Node.cpp
+++ b/ace/Parse_Node.cpp
@@ -88,8 +88,12 @@ ACE_Stream_Node::ACE_Stream_Node (const ACE_Static_Node *str_ops,
ACE_Stream_Node::~ACE_Stream_Node (void)
{
ACE_TRACE ("ACE_Stream_Node::~ACE_Stream_Node");
- delete (ACE_Static_Node *) this->node_;
- delete (ACE_Parse_Node *) this->mods_;
+ ACE_Static_Node *n = ACE_const_cast (ACE_Static_Node *,
+ this->node_);
+ delete n;
+ ACE_Parse_Node *m = ACE_const_cast (ACE_Parse_Node *,
+ this->mods_);
+ delete m;
}
ACE_Parse_Node::ACE_Parse_Node (void)
@@ -278,7 +282,8 @@ ACE_Static_Node::record (void) const
ACE_Service_Type *sr;
if (ACE_Service_Repository::instance()->find
- (ASYS_WIDE_STRING (this->name ()), (const ACE_Service_Type **) &sr) == -1)
+ (ASYS_WIDE_STRING (this->name ()),
+ (const ACE_Service_Type **) &sr) == -1)
return 0;
else
return sr;
@@ -380,7 +385,8 @@ ACE_Location_Node::open_handle (void)
ACE_TRACE ("ACE_Location_Node::open_handle");
ASYS_TCHAR dl_pathname[MAXPATHLEN + 1];
- const ASYS_TCHAR *name = ASYS_WIDE_STRING (this->pathname ());
+ const ASYS_TCHAR *name =
+ ASYS_WIDE_STRING (this->pathname ());
#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
ASYS_TCHAR dl_exppathname[MAXPATHLEN];
@@ -595,8 +601,12 @@ ACE_Dummy_Node::apply (void)
ACE_Dummy_Node::~ACE_Dummy_Node (void)
{
ACE_TRACE ("ACE_Dummy_Node::~ACE_Dummy_Node");
- delete (ACE_Static_Node *) this->node_;
- delete (ACE_Parse_Node *) this->mods_;
+ ACE_Static_Node *n = ACE_const_cast (ACE_Static_Node *,
+ this->node_);
+ delete n;
+ ACE_Parse_Node *m = ACE_const_cast (ACE_Parse_Node *,
+ this->mods_);
+ delete m;
}
ACE_ALLOC_HOOK_DEFINE(ACE_Static_Function_Node)
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index a7873dc2cf7..82eb7a5a137 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -308,7 +308,8 @@ ACE_Service_Config::initialize (const ACE_Service_Type *sr,
ASYS_TEXT ("insertion failed, %p\n"),
sr->name ()),
-1);
- else if (sr->type ()->init (args.argc (), args.argv ()) == -1)
+ else if (sr->type ()->init (args.argc (),
+ args.argv ()) == -1)
ACE_ERROR_RETURN ((LM_ERROR,
ASYS_TEXT ("dynamic initialization failed for %s\n"),
sr->name ()),
@@ -556,7 +557,9 @@ ACE_Service_Config::ACE_Service_Config (const ASYS_TCHAR program_name[],
// Signal handling API to trigger dynamic reconfiguration.
void
-ACE_Service_Config::handle_signal (int sig, siginfo_t *, ucontext_t *)
+ACE_Service_Config::handle_signal (int sig,
+ siginfo_t *,
+ ucontext_t *)
{
ACE_TRACE ("ACE_Service_Config::handle_signal");
@@ -565,12 +568,10 @@ ACE_Service_Config::handle_signal (int sig, siginfo_t *, ucontext_t *)
ASYS_TEXT ("error, signal %S does match %S\n"),
sig,
ACE_Service_Config::signum_));
-
if (ACE::debug ())
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("signal %S occurred\n"),
sig));
-
ACE_Service_Config::reconfig_occurred_ = 1;
}
@@ -591,7 +592,6 @@ ACE_Service_Config::reconfigure (void)
ASYS_TEXT ("beginning reconfiguration at %s"),
ACE_OS::ctime (&t)));
}
-
if (ACE_Service_Config::process_directives () == -1)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("%p\n"),
diff --git a/ace/Service_Object.h b/ace/Service_Object.h
index ce048e1f200..acd3719dbfe 100644
--- a/ace/Service_Object.h
+++ b/ace/Service_Object.h
@@ -66,9 +66,9 @@ public:
// = Initialization and termination methods.
ACE_Service_Type (const ASYS_TCHAR *n,
- ACE_Service_Type_Impl *o,
- const ACE_SHLIB_HANDLE handle,
- int active);
+ ACE_Service_Type_Impl *o,
+ const ACE_SHLIB_HANDLE handle,
+ int active);
~ACE_Service_Type (void);
const ASYS_TCHAR *name (void) const;
diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp
index 2e6d8040d86..60ba59d3a6b 100644
--- a/ace/Service_Repository.cpp
+++ b/ace/Service_Repository.cpp
@@ -241,12 +241,14 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
int i;
+ // Check to see if this is a duplicate.
for (i = 0; i < this->current_size_; i++)
if (ACE_OS::strcmp (sr->name (),
this->service_vector_[i]->name ()) == 0)
break;
- if (i < this->current_size_) // Replacing an existing entry
+ // Replacing an existing entry
+ if (i < this->current_size_)
{
// Check for self-assignment...
if (sr == this->service_vector_[i])
@@ -257,7 +259,8 @@ ACE_Service_Repository::insert (const ACE_Service_Type *sr)
this->service_vector_[i] = sr;
return 0;
}
- else if (i < this->total_size_) // Adding a new entry.
+ // Adding a new entry.
+ else if (i < this->total_size_)
{
this->service_vector_[i] = sr;
this->current_size_++;
diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y
index 02cf36b0c3d..8cb24221b8c 100644
--- a/ace/Svc_Conf.y
+++ b/ace/Svc_Conf.y
@@ -10,9 +10,9 @@ ACE_RCSID(ace, Svc_Conf_y, "$Id$")
// Prototypes.
static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec,
- ACE_Static_Node *svc_type);
+ ACE_Static_Node *svc_type);
static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec,
- const char *svc_name);
+ const char *svc_name);
#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext)
// Force the pretty debugging code to compile.
@@ -150,17 +150,26 @@ module_list
module
: dynamic
{
- if ($<static_node_>1 != 0)
+ ACE_Static_Node *svc_type = $<static_node_>1;
+
+ if (svc_type != 0)
{
- ACE_ARGV args (ASYS_WIDE_STRING ($<static_node_>1->parameters ()));
- ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, $<static_node_>1);
+ ACE_Static_Node *module = $<static_node_>-1;
+
+ ACE_ARGV args (ASYS_WIDE_STRING (svc_type->parameters ()));
+ ACE_Module_Type *mt = ace_get_module (module,
+ svc_type);
+ ACE_Stream_Type *st =
+ ACE_dynamic_cast (ACE_Stream_Type *,
+ ACE_const_cast (ACE_Service_Type_Impl *,
+ module->record ()->type ()));
if (mt->init (args.argc (), args.argv ()) == -1
- || ((ACE_Stream_Type *) ($<static_node_>-1)->record ()->type ())->push (mt) == -1)
+ || st->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("dynamic initialization failed for Module %s\n"),
- ASYS_WIDE_STRING ($<static_node_>1->name ())));
+ ASYS_WIDE_STRING (svc_type->name ())));
yyerrno++;
}
}
@@ -174,26 +183,35 @@ module
}
| suspend
{
- ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, $<static_node_>1->name ());
+ ACE_Module_Type *mt = ace_get_module ($<static_node_>-1,
+ $<static_node_>1->name ());
if (mt != 0)
mt->suspend ();
}
| resume
{
- ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, $<static_node_>1->name ());
+ ACE_Module_Type *mt = ace_get_module ($<static_node_>-1,
+ $<static_node_>1->name ());
if (mt != 0)
mt->resume ();
}
| remove
{
- ACE_Module_Type *mt = ace_get_module ($<static_node_>-1, $<static_node_>1->name ());
- if (mt != 0
- && ((ACE_Stream_Type *) ($<static_node_>-1)->record ()->type ())->remove (mt) == -1)
+ ACE_Static_Node *stream = $<static_node_>-1;
+ ACE_Static_Node *module = $<static_node_>1;
+ ACE_Module_Type *mt = ace_get_module (stream,
+ module->name ());
+
+ ACE_Stream_Type *st =
+ ACE_dynamic_cast (ACE_Stream_Type *,
+ ACE_const_cast (ACE_Service_Type_Impl *,
+ stream->record ()->type ()));
+ if (mt != 0 && st->remove (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"),
- ASYS_WIDE_STRING ($<static_node_>1->name ()),
- ASYS_WIDE_STRING (($<static_node_>-1)->name ())));
+ ASYS_WIDE_STRING (module->name ()),
+ ASYS_WIDE_STRING (stream->name ())));
yyerrno++;
}
}
@@ -308,7 +326,11 @@ ace_get_module (ACE_Static_Node *str_rec,
{
const ACE_Service_Type *sr = str_rec->record ();
const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type;
+ ACE_Stream_Type *st = sr == 0
+ ? 0
+ : ACE_dynamic_cast (ACE_Stream_Type *,
+ ACE_const_cast (ACE_Service_Type_Impl *,
+ type));
ACE_Module_Type *mt = st == 0 ? 0 : st->find (ASYS_WIDE_STRING (svc_name));
if (sr == 0 || st == 0 || mt == 0)
diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp
index 8823040d433..62a1d6f68d1 100644
--- a/ace/Svc_Conf_y.cpp
+++ b/ace/Svc_Conf_y.cpp
@@ -14,9 +14,9 @@ ACE_RCSID(ace, Svc_Conf_y, "$Id$")
/* Prototypes.*/
static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec,
- ACE_Static_Node *svc_type);
+ ACE_Static_Node *svc_type);
static ACE_Module_Type *ace_get_module (ACE_Static_Node *str_rec,
- const char *svc_name);
+ const char *svc_name);
#define ACE_YYDEBUG_LEXER_TEXT (ace_yytext[ace_yyleng] = '\0', ace_yytext)
/* Force the pretty debugging code to compile.*/
@@ -249,7 +249,7 @@ ACE_YYSTYPE ace_yylval;
#define ace_yystacksize ACE_YYSTACKSIZE
short ace_yyss[ACE_YYSTACKSIZE];
ACE_YYSTYPE ace_yyvs[ACE_YYSTACKSIZE];
-#line 289 "Svc_Conf.y"
+#line 307 "Svc_Conf.y"
// Prints the error string to standard output. Cleans up the error
// messages.
@@ -272,7 +272,11 @@ ace_get_module (ACE_Static_Node *str_rec,
{
const ACE_Service_Type *sr = str_rec->record ();
const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type;
+ ACE_Stream_Type *st = sr == 0
+ ? 0
+ : ACE_dynamic_cast (ACE_Stream_Type *,
+ ACE_const_cast (ACE_Service_Type_Impl *,
+ type));
ACE_Module_Type *mt = st == 0 ? 0 : st->find (ASYS_WIDE_STRING (svc_name));
if (sr == 0 || st == 0 || mt == 0)
@@ -388,7 +392,7 @@ main (int argc, char *argv[])
return ace_yyparse ();
}
#endif /* DEBUGGING */
-#line 392 "Svc_Conf_y.cpp"
+#line 396 "Svc_Conf_y.cpp"
#define ACE_YYABORT goto ace_yyabort
#define ACE_YYACCEPT goto ace_yyaccept
#define ACE_YYERROR goto ace_yyerrlab
@@ -803,24 +807,33 @@ break;
case 25:
#line 152 "Svc_Conf.y"
{
- if (ace_yyvsp[0].static_node_ != 0)
+ ACE_Static_Node *svc_type = ace_yyvsp[0].static_node_;
+
+ if (svc_type != 0)
{
- ACE_ARGV args (ASYS_WIDE_STRING (ace_yyvsp[0].static_node_->parameters ()));
- ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_);
+ ACE_Static_Node *module = ace_yyvsp[-2].static_node_;
+
+ ACE_ARGV args (ASYS_WIDE_STRING (svc_type->parameters ()));
+ ACE_Module_Type *mt = ace_get_module (module,
+ svc_type);
+ ACE_Stream_Type *st =
+ ACE_dynamic_cast (ACE_Stream_Type *,
+ ACE_const_cast (ACE_Service_Type_Impl *,
+ module->record ()->type ()));
if (mt->init (args.argc (), args.argv ()) == -1
- || ((ACE_Stream_Type *) (ace_yyvsp[-2].static_node_)->record ()->type ())->push (mt) == -1)
+ || st->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("dynamic initialization failed for Module %s\n"),
- ASYS_WIDE_STRING (ace_yyvsp[0].static_node_->name ())));
+ ASYS_WIDE_STRING (svc_type->name ())));
ace_yyerrno++;
}
}
}
break;
case 26:
-#line 169 "Svc_Conf.y"
+#line 178 "Svc_Conf.y"
{
ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
@@ -829,38 +842,47 @@ case 26:
}
break;
case 27:
-#line 176 "Svc_Conf.y"
+#line 185 "Svc_Conf.y"
{
- ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
+ ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_,
+ ace_yyvsp[0].static_node_->name ());
if (mt != 0)
mt->suspend ();
}
break;
case 28:
-#line 182 "Svc_Conf.y"
+#line 192 "Svc_Conf.y"
{
- ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
+ ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_,
+ ace_yyvsp[0].static_node_->name ());
if (mt != 0)
mt->resume ();
}
break;
case 29:
-#line 188 "Svc_Conf.y"
+#line 199 "Svc_Conf.y"
{
- ACE_Module_Type *mt = ace_get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
- if (mt != 0
- && ((ACE_Stream_Type *) (ace_yyvsp[-2].static_node_)->record ()->type ())->remove (mt) == -1)
+ ACE_Static_Node *stream = ace_yyvsp[-2].static_node_;
+ ACE_Static_Node *module = ace_yyvsp[0].static_node_;
+ ACE_Module_Type *mt = ace_get_module (stream,
+ module->name ());
+
+ ACE_Stream_Type *st =
+ ACE_dynamic_cast (ACE_Stream_Type *,
+ ACE_const_cast (ACE_Service_Type_Impl *,
+ stream->record ()->type ()));
+ if (mt != 0 && st->remove (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"),
- ASYS_WIDE_STRING (ace_yyvsp[0].static_node_->name ()),
- ASYS_WIDE_STRING ((ace_yyvsp[-2].static_node_)->name ())));
+ ASYS_WIDE_STRING (module->name ()),
+ ASYS_WIDE_STRING (stream->name ())));
ace_yyerrno++;
}
}
break;
case 30:
-#line 204 "Svc_Conf.y"
+#line 222 "Svc_Conf.y"
{
u_int flags
= ACE_Service_Type::DELETE_THIS
@@ -890,64 +912,64 @@ case 30:
}
break;
case 31:
-#line 235 "Svc_Conf.y"
+#line 253 "Svc_Conf.y"
{
ace_yyval.type_ = 1;
}
break;
case 32:
-#line 239 "Svc_Conf.y"
+#line 257 "Svc_Conf.y"
{
ace_yyval.type_ = 0;
}
break;
case 33:
-#line 243 "Svc_Conf.y"
+#line 261 "Svc_Conf.y"
{
ace_yyval.type_ = 1;
}
break;
case 34:
-#line 250 "Svc_Conf.y"
+#line 268 "Svc_Conf.y"
{
ace_yyval.location_node_ = new ACE_Object_Node (ace_yyvsp[-2].ident_, ace_yyvsp[0].ident_);
}
break;
case 35:
-#line 254 "Svc_Conf.y"
+#line 272 "Svc_Conf.y"
{
ace_yyval.location_node_ = new ACE_Function_Node (ace_yyvsp[-4].ident_, ace_yyvsp[-2].ident_);
}
break;
case 36:
-#line 258 "Svc_Conf.y"
+#line 276 "Svc_Conf.y"
{
ace_yyval.location_node_ = new ACE_Static_Function_Node (ace_yyvsp[-2].ident_);
}
break;
case 37:
-#line 265 "Svc_Conf.y"
+#line 283 "Svc_Conf.y"
{
ace_yyval.type_ = ACE_MODULE_T;
}
break;
case 38:
-#line 269 "Svc_Conf.y"
+#line 287 "Svc_Conf.y"
{
ace_yyval.type_ = ACE_SVC_OBJ_T;
}
break;
case 39:
-#line 273 "Svc_Conf.y"
+#line 291 "Svc_Conf.y"
{
ace_yyval.type_ = ACE_STREAM_T;
}
break;
case 41:
-#line 280 "Svc_Conf.y"
+#line 298 "Svc_Conf.y"
{ ace_yyval.ident_ = 0; }
break;
-#line 950 "Svc_Conf_y.cpp"
+#line 972 "Svc_Conf_y.cpp"
}
ace_yyssp -= ace_yym;
ace_yystate = *ace_yyssp;