From 9a39848ba93eaa56f7f62921f8de7a19e3ed0713 Mon Sep 17 00:00:00 2001 From: sapier Date: Sun, 6 Apr 2014 14:02:53 +0200 Subject: [PATCH] Remove a lot of superfluous ifndef USE_CURL checks --- src/convert_json.cpp | 9 +++++---- src/script/lua_api/l_mainmenu.cpp | 10 ++-------- src/serverlist.cpp | 3 --- src/serverlist.h | 2 -- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/convert_json.cpp b/src/convert_json.cpp index 6f227e796..a6107aa64 100644 --- a/src/convert_json.cpp +++ b/src/convert_json.cpp @@ -32,19 +32,20 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "porting.h" Json::Value fetchJsonValue(const std::string &url, - struct curl_slist *chunk) { -#if USE_CURL + struct curl_slist *chunk) { HTTPFetchRequest fetchrequest; HTTPFetchResult fetchresult; fetchrequest.url = url; fetchrequest.caller = HTTPFETCH_SYNC; +#if USE_CURL struct curl_slist* runptr = chunk; while(runptr) { fetchrequest.extra_headers.push_back(runptr->data); runptr = runptr->next; } +#endif httpfetch_sync(fetchrequest,fetchresult); if (!fetchresult.succeeded) { @@ -71,12 +72,12 @@ Json::Value fetchJsonValue(const std::string &url, else { return root; } -#endif + return Json::Value(); } std::vector readModStoreList(Json::Value& modlist) { - std::vector retval; + std::vector retval; if (modlist.isArray()) { for (unsigned int i = 0; i < modlist.size(); i++) diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index f2628d0a1..cb32c9e82 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -456,15 +456,12 @@ int ModApiMainMenu::l_get_favorites(lua_State *L) } std::vector servers; -#if USE_CURL + if(listtype == "online") { servers = ServerList::getOnline(); } else { servers = ServerList::getLocal(); } -#else - servers = ServerList::getLocal(); -#endif lua_newtable(L); int top = lua_gettop(L); @@ -582,15 +579,12 @@ int ModApiMainMenu::l_delete_favorite(lua_State *L) (listtype != "online")) return 0; -#if USE_CURL + if(listtype == "online") { servers = ServerList::getOnline(); } else { servers = ServerList::getLocal(); } -#else - servers = ServerList::getLocal(); -#endif int fav_idx = luaL_checkinteger(L,1) -1; diff --git a/src/serverlist.cpp b/src/serverlist.cpp index 10ec5771f..00b5f2dee 100644 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -68,7 +68,6 @@ std::vector getLocal() } -#if USE_CURL std::vector getOnline() { Json::Value root = fetchJsonValue((g_settings->get("serverlist_url")+"/list").c_str(),0); @@ -87,8 +86,6 @@ std::vector getOnline() return serverlist; } -#endif - /* Delete a server fromt he local favorites list */ diff --git a/src/serverlist.h b/src/serverlist.h index 915e8482f..bc40a1b39 100644 --- a/src/serverlist.h +++ b/src/serverlist.h @@ -30,9 +30,7 @@ typedef Json::Value ServerListSpec; namespace ServerList { std::vector getLocal(); - #if USE_CURL std::vector getOnline(); - #endif bool deleteEntry(ServerListSpec server); bool insert(ServerListSpec server); std::vector deSerialize(std::string liststring);