On Thu, May 23, 2013 at 01:23:40PM +0300, Michael S. Tsirkin wrote:
> On Thu, May 23, 2013 at 05:08:00PM +0800, Amos Kong wrote:
> > + info->broadcast_allowed = n->nobcast;
> > + info->multicast_overflow = n->mac_table.multi_overflow;
> > + info->unicast_overflow = n->mac_table.uni_overflow;
> > + info->main_mac = g_strdup_printf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x",
> > + n->mac[0], n->mac[1], n->mac[2],
> > + n->mac[3], n->mac[4], n->mac[5]);
>
> We really want a helper for this g_strdup_printf thing IMO.
entry->value = mac_strdup_printf(n->mac_table.macs + i * ETH_ALEN);
static char *mac_strdup_printf(uint8_t *mac)
{
return g_strdup_printf("%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", mac[0],
mac[1], mac[2], mac[3], mac[4], mac[5]);
}
--
Amos.