Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Nov 7, 2017
1 parent e26c728 commit dba9a20
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/uvw/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,20 +420,6 @@ std::string tryRead(F &&f, Args&&... args) noexcept {
}


template<typename F, typename... Args>
std::string indexTo(F &&f, Args&&... args) noexcept {
std::size_t size = UV_IF_NAMESIZE;
char buf[size];
std::string str{};

if(0 == std::forward<F>(f)(args..., buf, &size)) {
str.assign(buf, size);
}

return str;
}


}


Expand Down Expand Up @@ -692,7 +678,7 @@ struct Utilities {
* @return Network interface name.
*/
static std::string indexToName(unsigned int index) noexcept {
return details::indexTo(&uv_if_indextoname, index);
return details::tryRead(&uv_if_indextoname, index);
}

/**
Expand All @@ -706,7 +692,7 @@ struct Utilities {
* @return Network interface identifier.
*/
static std::string indexToIid(unsigned int index) noexcept {
return details::indexTo(&uv_if_indextoiid, index);
return details::tryRead(&uv_if_indextoiid, index);
}

/**
Expand Down

0 comments on commit dba9a20

Please sign in to comment.