summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-05-18 11:53:22 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2008-05-18 11:53:22 +0000
commite59f4f2fe3280b86c76fe5424d171e3e33113beb (patch)
tree65dfbf2b309a7588288b2c0687dc629fa5a7b399 /src
parent7235f2657fee344ebc0bbae539cc291b192bc37a (diff)
2008-05-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Return const reference. * src/DownloadHandlerConstants.cc * src/DownloadHandlerConstants.h (getMetalinkExtensions) (getMetalinkContentTypes) (getBtExtensions) (getBtContentTypes)
Diffstat (limited to 'src')
-rw-r--r--src/DownloadHandlerConstants.cc32
-rw-r--r--src/DownloadHandlerConstants.h8
2 files changed, 24 insertions, 16 deletions
diff --git a/src/DownloadHandlerConstants.cc b/src/DownloadHandlerConstants.cc
index 301a34c9..457f5a38 100644
--- a/src/DownloadHandlerConstants.cc
+++ b/src/DownloadHandlerConstants.cc
@@ -49,28 +49,36 @@ const char* DownloadHandlerConstants::BT_CONTENT_TYPES[] = {
"application/x-bittorrent"
};
-std::deque<std::string> DownloadHandlerConstants::getMetalinkExtensions()
+const std::deque<std::string>& DownloadHandlerConstants::getMetalinkExtensions()
{
- return std::deque<std::string>(&METALINK_EXTENSIONS[0],
- &METALINK_EXTENSIONS[arrayLength(METALINK_EXTENSIONS)]);
+ static const std::deque<std::string> l
+ (&METALINK_EXTENSIONS[0],
+ &METALINK_EXTENSIONS[arrayLength(METALINK_EXTENSIONS)]);
+ return l;
}
-std::deque<std::string> DownloadHandlerConstants::getMetalinkContentTypes()
+const std::deque<std::string>& DownloadHandlerConstants::getMetalinkContentTypes()
{
- return std::deque<std::string>(&METALINK_CONTENT_TYPES[0],
- &METALINK_CONTENT_TYPES[arrayLength(METALINK_CONTENT_TYPES)]);
+ static const std::deque<std::string> l
+ (&METALINK_CONTENT_TYPES[0],
+ &METALINK_CONTENT_TYPES[arrayLength(METALINK_CONTENT_TYPES)]);
+ return l;
}
-std::deque<std::string> DownloadHandlerConstants::getBtExtensions()
+const std::deque<std::string>& DownloadHandlerConstants::getBtExtensions()
{
- return std::deque<std::string>(&BT_EXTENSIONS[0],
- &BT_EXTENSIONS[arrayLength(BT_EXTENSIONS)]);
+ static const std::deque<std::string> l
+ (&BT_EXTENSIONS[0],
+ &BT_EXTENSIONS[arrayLength(BT_EXTENSIONS)]);
+ return l;
}
-std::deque<std::string> DownloadHandlerConstants::getBtContentTypes()
+const std::deque<std::string>& DownloadHandlerConstants::getBtContentTypes()
{
- return std::deque<std::string>(&BT_CONTENT_TYPES[0],
- &BT_CONTENT_TYPES[arrayLength(BT_CONTENT_TYPES)]);
+ static const std::deque<std::string> l
+ (&BT_CONTENT_TYPES[0],
+ &BT_CONTENT_TYPES[arrayLength(BT_CONTENT_TYPES)]);
+ return l;
}
} // namespace aria2
diff --git a/src/DownloadHandlerConstants.h b/src/DownloadHandlerConstants.h
index 7e7f34ab..4a8699a0 100644
--- a/src/DownloadHandlerConstants.h
+++ b/src/DownloadHandlerConstants.h
@@ -46,19 +46,19 @@ class DownloadHandlerConstants
public:
static const char* METALINK_EXTENSIONS[];
- static std::deque<std::string> getMetalinkExtensions();
+ static const std::deque<std::string>& getMetalinkExtensions();
static const char* METALINK_CONTENT_TYPES[];
- static std::deque<std::string> getMetalinkContentTypes();
+ static const std::deque<std::string>& getMetalinkContentTypes();
static const char* BT_EXTENSIONS[];
- static std::deque<std::string> getBtExtensions();
+ static const std::deque<std::string>& getBtExtensions();
static const char* BT_CONTENT_TYPES[];
- static std::deque<std::string> getBtContentTypes();
+ static const std::deque<std::string>& getBtContentTypes();
};
} // namespace aria2