summaryrefslogtreecommitdiff
path: root/ACE/ace/Svc_Conf.y
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2006-10-23 23:31:00 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2006-10-23 23:31:00 +0000
commit493991791e3c7232fa33f428177dbfc9b666adac (patch)
treef937218c26da44d35b11b3ddeee1804031b5d99a /ACE/ace/Svc_Conf.y
parentfe745d19b69bcac8e99ca5304656eada195cd1c6 (diff)
downloadATCD-493991791e3c7232fa33f428177dbfc9b666adac.tar.gz
ChangeLogTag:Mon Oct 23 02:28:42 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
Diffstat (limited to 'ACE/ace/Svc_Conf.y')
-rw-r--r--ACE/ace/Svc_Conf.y71
1 files changed, 40 insertions, 31 deletions
diff --git a/ACE/ace/Svc_Conf.y b/ACE/ace/Svc_Conf.y
index a3b5b7f7080..b3ba6ca31ca 100644
--- a/ACE/ace/Svc_Conf.y
+++ b/ACE/ace/Svc_Conf.y
@@ -22,13 +22,13 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
// Prototypes.
-static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr,
- const ACE_Service_Type *sv,
- int & ace_yyerrno);
+static ACE_Module_Type *ace_get_module (ACE_Service_Type const * sr,
+ ACE_Service_Type const * sv,
+ int & ace_yyerrno);
-static ACE_Module_Type *ace_get_module (const ACE_Service_Type *sr,
- const ACE_TCHAR *svc_name,
- int & ace_yyerrno);
+static ACE_Module_Type *ace_get_module (ACE_Service_Type const * sr,
+ ACE_TCHAR const * svc_name,
+ int & ace_yyerrno);
#define YYDEBUG_LEXER_TEXT (yytext[yyleng] = '\0', yytext)
@@ -183,7 +183,9 @@ module
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (module->record (ACE_SVC_CONF_PARAM->config)->type ()));
- if (mt->init (args.argc (), args.argv ()) == -1
+ if (!st
+ || !mt
+ || mt->init (args.argc (), args.argv ()) == -1
|| st->push (mt) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -235,7 +237,7 @@ module
ACE_Stream_Type *st =
dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (stream->record (ACE_SVC_CONF_PARAM->config)->type ()));
- if (mt != 0 && st->remove (mt) == -1)
+ if (!st || (mt != 0 && st->remove (mt) == -1))
{
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("cannot remove Module_Type %s from STREAM_Type %s\n"),
@@ -336,54 +338,61 @@ yyerror (int yyerrno, int yylineno, const char *s)
// record.
static ACE_Module_Type *
-ace_get_module (const ACE_Service_Type *sr,
- const ACE_TCHAR *svc_name,
+ace_get_module (ACE_Service_Type const * sr,
+ ACE_TCHAR const * svc_name,
int & yyerrno)
{
- const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0
- ? 0
- : dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (type));
- ACE_Module_Type *mt = st == 0 ? 0 : st->find (svc_name);
+ ACE_Service_Type_Impl const * const type = sr->type ();
+ ACE_Stream_Type const * const st =
+ (sr == 0
+ ? 0
+ : dynamic_cast<ACE_Stream_Type const *> (type));
+ ACE_Module_Type const * const mt = (st == 0 ? 0 : st->find (svc_name));
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
- ACE_LIB_TEXT ("cannot locate Module_Type %s in STREAM_Type %s\n"),
+ ACE_LIB_TEXT ("cannot locate Module_Type %s ")
+ ACE_LIB_TEXT ("in STREAM_Type %s\n"),
svc_name,
- sr->name ()));
- yyerrno++;
+ (sr ? sr->name () : ACE_LIB_TEXT ("(nil)"))));
+ ++yyerrno;
}
- return mt;
+ return const_cast<ACE_Module_Type *> (mt);
}
static ACE_Module_Type *
-ace_get_module (const ACE_Service_Type *sr,
- const ACE_Service_Type *sv,
+ace_get_module (ACE_Service_Type const * sr,
+ ACE_Service_Type const * sv,
int & yyerrno)
{
- const ACE_Service_Type_Impl *type = sr->type ();
- ACE_Stream_Type *st = sr == 0 ? 0 : (ACE_Stream_Type *) type;
+ ACE_Stream_Type const * const st =
+ (sr == 0
+ ? 0
+ : static_cast<ACE_Stream_Type const *> (sr->type ()));
+
+ ACE_Module_Type const * const mt =
+ static_cast <ACE_Module_Type const *> (sv->type ());
- type = sv->type ();
- ACE_Module_Type *mt = (ACE_Module_Type *) type;
- const ACE_TCHAR *module_type_name = sr->name ();
+ ACE_TCHAR const * const module_type_name =
+ (mt ? mt->name () : ACE_LIB_TEXT ("(nil)"));
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"),
module_type_name,
- sr->name ()));
- yyerrno++;
+ (sr ? sr->name () : ACE_LIB_TEXT ("(nil)"))));
+ ++yyerrno;
}
// Make sure that the Module has the same name as the
// Module_Type object from the svc.conf file.
- ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
+ ACE_Module<ACE_SYNCH> * const mp =
+ static_cast<ACE_Module<ACE_SYNCH> *> (mt ? mt->object () : 0);
- if (ACE_OS::strcmp (mp->name (), module_type_name) != 0)
+ if (mp && ACE_OS::strcmp (mp->name (), module_type_name) != 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_LIB_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
@@ -392,7 +401,7 @@ ace_get_module (const ACE_Service_Type *sr,
mp->name (module_type_name);
}
- return mt;
+ return const_cast<ACE_Module_Type *> (mt);
}
#if defined (DEBUGGING)