From: Scott Cantor Date: Tue, 10 Mar 2009 01:46:54 +0000 (+0000) Subject: Switch to reference parameters as appropriate. X-Git-Tag: 1.2.0~27 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-xmltooling.git;a=commitdiff_plain;h=89a00400e6d1d8740474e5479dc8752e9f97c667 Switch to reference parameters as appropriate. --- diff --git a/xmltooling/util/TemplateEngine.cpp b/xmltooling/util/TemplateEngine.cpp index 22881e3..2333c8c 100644 --- a/xmltooling/util/TemplateEngine.cpp +++ b/xmltooling/util/TemplateEngine.cpp @@ -206,20 +206,19 @@ void TemplateEngine::process( trimspace(key); lastpos = thispos + 1; // strlen(">") } - const vector forParams = parameters.getParameterCollection(key.c_str()); - unsigned int forend = forParams.size(); - if (forend==0) { // have to go through at least once to match end tags + const vector& forParams = parameters.getParameterCollection(key.c_str()); + vector::size_type forend = forParams.size(); + if (forend == 0) { // have to go through at least once to match end tags cond = false; forend = 1; } const char *savlastpos = lastpos; - for (unsigned int i=0; i0? static_cast(&forParams[i]): &nullp; + for (vector::size_type i=0; i0 ? forParams[i] : nullp), e); } } diff --git a/xmltooling/util/TemplateEngine.h b/xmltooling/util/TemplateEngine.h index ad4027b..4023b52 100644 --- a/xmltooling/util/TemplateEngine.h +++ b/xmltooling/util/TemplateEngine.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ namespace xmltooling { * @param name name of parameter collection * @return vector of parameters */ - virtual const std::vector getParameterCollection(const char* name) const { + virtual const std::vector& getParameterCollection(const char* name) const { std::map >::const_iterator i=m_collectionMap.find(name); return (i->second); }