From 2a1ef0621e4af61c784d425767cd0f9f46911d40 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 31 Jul 2002 16:45:35 +0000 Subject: [PATCH] Patch from Julian Foad: Use getDisplayName instead of duplicated code. Replace unnecessary node lookups by name with direct access. --- src/Network/httpd.cxx | 7 +------ src/Network/telnet.cxx | 15 +++------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/Network/httpd.cxx b/src/Network/httpd.cxx index 97ab9b5d4..1c01ac7eb 100644 --- a/src/Network/httpd.cxx +++ b/src/Network/httpd.cxx @@ -178,12 +178,7 @@ void HttpdChannel::foundTerminator (void) { for (int i = 0; i < node->nChildren(); i++) { SGPropertyNode *child = node->getChild(i); - string name = child->getName(); - if ( node->getChild(name.c_str(), 1) ) { - char buf[16]; - sprintf(buf, "[%d]", child->getIndex()); - name += buf; - } + string name = child->getDisplayName(true); string line = ""; if ( child->nChildren() > 0 ) { line += "nChildren(); i++) { SGPropertyNode * child = dir->getChild(i); - string name = child->getName(); - string line = name; - - if (dir->getChild( name.c_str(), 1 )) - { - char buf[16]; - sprintf(buf, "[%d]", child->getIndex()); - line += buf; - } + string line = child->getDisplayName(true); if ( child->nChildren() > 0 ) { @@ -219,10 +211,9 @@ TelnetChannel::foundTerminator() { if (mode == PROMPT) { - string value = dir->getStringValue( name.c_str(), "" ); + string value = child->getStringValue(); line += " =\t'" + value + "'\t("; - line += getValueTypeString( - dir->getNode( name.c_str() ) ); + line += getValueTypeString( child ); line += ")"; } }