> On March 3, 2015, 6:39 p.m., Jie Yu wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp, lines 454-462 > > <https://reviews.apache.org/r/31471/diff/4/?file=882869#file882869line454> > > > > The code here is a little verbose. I am wondering can we simply this > > code by introducing a `IP::create` function for `struct sockaddr`. > > > > ``` > > Try<IP> IP::create(const struct sockaddr& addr); > > > > IP address = IP::create(ifa->ifa_addr).get(); > > > > if (xxx) { > > IP netmask = IP::create(ifa->ifa_netmask).get(); > > ... > > } > > > > ... > > ``` > > Evelina Dumitrescu wrote: > why is it verbose?
you have switch-case several times and you need to do `free` in each default case! - Jie ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/31471/#review74987 ----------------------------------------------------------- On March 3, 2015, 11:27 a.m., Evelina Dumitrescu wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/31471/ > ----------------------------------------------------------- > > (Updated March 3, 2015, 11:27 a.m.) > > > Review request for mesos, Benjamin Hindman, Dominic Hamon, Jie Yu, Joris Van > Remoortere, and Niklas Nielsen. > > > Repository: mesos > > > Description > ------- > > see summary > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/ip.hpp > 0cd7cb526a3a2514b3b54552253dfa8919e948d0 > 3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp > 9635bbc6f7dae1d75a780069fcc60fb706221053 > 3rdparty/libprocess/3rdparty/stout/tests/ip_tests.cpp > fb98317a68986cb1228c584a8cd83b07737895a8 > > Diff: https://reviews.apache.org/r/31471/diff/ > > > Testing > ------- > > > Thanks, > > Evelina Dumitrescu > >