Skip to content

Commit

Permalink
Remove a lot of superfluous ifndef USE_CURL checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sapier authored and sapier committed Jun 19, 2014
1 parent 99f565e commit 9a39848
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
9 changes: 5 additions & 4 deletions src/convert_json.cpp
Expand Up @@ -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) {
Expand All @@ -71,12 +72,12 @@ Json::Value fetchJsonValue(const std::string &url,
else {
return root;
}
#endif

return Json::Value();
}

std::vector<ModStoreMod> readModStoreList(Json::Value& modlist) {
std::vector<ModStoreMod> retval;
std::vector<ModStoreMod> retval;

if (modlist.isArray()) {
for (unsigned int i = 0; i < modlist.size(); i++)
Expand Down
10 changes: 2 additions & 8 deletions src/script/lua_api/l_mainmenu.cpp
Expand Up @@ -456,15 +456,12 @@ int ModApiMainMenu::l_get_favorites(lua_State *L)
}

std::vector<ServerListSpec> 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);
Expand Down Expand Up @@ -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;

Expand Down
3 changes: 0 additions & 3 deletions src/serverlist.cpp
Expand Up @@ -68,7 +68,6 @@ std::vector<ServerListSpec> getLocal()
}


#if USE_CURL
std::vector<ServerListSpec> getOnline()
{
Json::Value root = fetchJsonValue((g_settings->get("serverlist_url")+"/list").c_str(),0);
Expand All @@ -87,8 +86,6 @@ std::vector<ServerListSpec> getOnline()
return serverlist;
}

#endif

/*
Delete a server fromt he local favorites list
*/
Expand Down
2 changes: 0 additions & 2 deletions src/serverlist.h
Expand Up @@ -30,9 +30,7 @@ typedef Json::Value ServerListSpec;
namespace ServerList
{
std::vector<ServerListSpec> getLocal();
#if USE_CURL
std::vector<ServerListSpec> getOnline();
#endif
bool deleteEntry(ServerListSpec server);
bool insert(ServerListSpec server);
std::vector<ServerListSpec> deSerialize(std::string liststring);
Expand Down

0 comments on commit 9a39848

Please sign in to comment.