On Sat, Jul 15, 2017 at 09:33:06PM +0800, Hangbin Liu wrote: > @@ -92,6 +151,18 @@ int rtnl_link_status(int fd, rtnl_callback cb, void *ctx) > struct msghdr msg; > struct nlmsghdr *nh; > struct ifinfomsg *info = NULL; > + char *device; > + struct rtattr *tb[IFLA_MAX+1]; > + > + if (cb) > + device = calloc(1, sizeof(MAX_IFNAME_SIZE + 1)); > + else > + device = (char *)ctx;
The meaning of 'ctx' changes according to the value of 'cb'. This overloading of the function arguments is gross. Please find another way to structure this. You only have two call paths for rtnl_link_status: 1. port_event() -> rtnl_link_status() 2. clock_create() -> rtnl_link_info() -> rtnl_link_status() Thanks, Richard ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel