http://bugzilla.moblin.org/show_bug.cgi?id=8177
--- Comment #1 from pohly <patrick.ohly(a)intel.com> 2010-01-11 10:12:08 PST ---
Merged into 0.9 branch, after squashing all the different commits into one.
I also made some further changes:
- avoid polluting the global name space with the PROXY_STRING define;
if a define is necessary (which is not the case here, a local string
constant works much better), it should start with SE_
- fixed indention
- use string cache even when reading from env, just for the (unlikely)
case that setenv() is called while the proxy string pointer is in use
- don't include glib.h in SyncConfig.h, it is not needed and might not
be available
diff --git a/src/syncevo/SyncConfig.cpp b/src/syncevo/SyncConfig.cpp
index 6f26de3..61c128f 100644
--- a/src/syncevo/SyncConfig.cpp
+++ b/src/syncevo/SyncConfig.cpp
@@ -1212,16 +1212,17 @@ ConfigPasswordKey
ProxyPasswordConfigProperty::getPasswordKey(const string &desc
void SyncConfig::setPassword(const string &value, bool temporarily) {
m_cachedPassword = ""; syncPropPassword.setProperty(*getNode(syncPropPassword),
value, temporarily); }
+static const char *ProxyString = "http_proxy";
+
/* Reads http_proxy from environment, if not available returns configured
value */
bool SyncConfig::getUseProxy() const {
-
- char *proxy = getenv (PROXY_STRING);
+ char *proxy = getenv(ProxyString);
if (!proxy ) {
return syncPropUseProxy.getPropertyValue(*getNode(syncPropUseProxy));
} else if (strlen(proxy)>0) {
- return TRUE;
+ return TRUE;
} else {
- return FALSE;
+ return FALSE;
}
}
@@ -1229,12 +1230,11 @@ void SyncConfig::setUseProxy(bool value, bool
temporarily) { syncPropUseProxy.se
/* If http_proxy set in the environment returns it, otherwise configured value
*/
const char *SyncConfig::getProxyHost() const {
-
- char *proxy = getenv (PROXY_STRING);
- if (!proxy ) {
+ char *proxy = getenv(ProxyString);
+ if (!proxy) {
return
m_stringCache.getProperty(*getNode(syncPropProxyHost),syncPropProxyHost);
} else {
- return proxy;
+ return m_stringCache.storeString(syncPropProxyHost.getName(), proxy);
}
}
diff --git a/src/syncevo/SyncConfig.h b/src/syncevo/SyncConfig.h
index 8331604..5f89e21 100644
--- a/src/syncevo/SyncConfig.h
+++ b/src/syncevo/SyncConfig.h
@@ -41,9 +41,6 @@
SE_BEGIN_CXX
using namespace std;
-#define PROXY_VALUE_LEN 255
-#define PROXY_STRING "http_proxy"
-
/**
* @defgroup ConfigHandling Configuration Handling
* @{
--
Configure bugmail:
http://bugzilla.moblin.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching someone on the CC list of the bug.