untabify/style

This commit is contained in:
Doug MacEachern 2011-04-12 15:06:33 -07:00
parent cef810dafb
commit 4655d5e3df
1 changed files with 32 additions and 29 deletions

View File

@ -2680,18 +2680,18 @@ sigar_net_interface_name_get(sigar_t *sigar, MIB_IFROW *ifr, PIP_ADAPTER_ADDRESS
} }
for (iter = address_list; iter != NULL; iter = iter->Next) { for (iter = address_list; iter != NULL; iter = iter->Next) {
for(lpc = 0; lpc < iter->PhysicalAddressLength; lpc++) { for (lpc = 0; lpc < iter->PhysicalAddressLength; lpc++) {
if(iter->PhysicalAddress[lpc] != ifr->bPhysAddr[lpc]) { if (iter->PhysicalAddress[lpc] != ifr->bPhysAddr[lpc]) {
break; break;
} }
} }
if(lpc == iter->PhysicalAddressLength) { if (lpc == iter->PhysicalAddressLength) {
match = malloc(MAX_INTERFACE_NAME_LEN); match = malloc(MAX_INTERFACE_NAME_LEN);
wcstombs(match, iter->FriendlyName, MAX_INTERFACE_NAME_LEN); wcstombs(match, iter->FriendlyName, MAX_INTERFACE_NAME_LEN);
match[MAX_INTERFACE_NAME_LEN-1] = 0; match[MAX_INTERFACE_NAME_LEN-1] = 0;
break; break;
} }
} }
return match; return match;
@ -2750,29 +2750,32 @@ sigar_net_interface_list_get(sigar_t *sigar,
} }
else if (ifr->dwType == MIB_IF_TYPE_LOOPBACK) { else if (ifr->dwType == MIB_IF_TYPE_LOOPBACK) {
friendly = sigar_net_interface_name_get(sigar, ifr, address_list); friendly = sigar_net_interface_name_get(sigar, ifr, address_list);
if(friendly == NULL) { if (friendly == NULL) {
sprintf(name, "lo%d", lo++); sprintf(name, "lo%d", lo++);
} else { }
snprintf(name, MAX_INTERFACE_NAME_LEN, "%s", friendly); else {
} snprintf(name, MAX_INTERFACE_NAME_LEN, "%s", friendly);
name[MAX_INTERFACE_NAME_LEN] = 0; }
free(friendly); name[MAX_INTERFACE_NAME_LEN] = 0;
free(friendly);
} }
else if ((ifr->dwType == MIB_IF_TYPE_ETHERNET) || else if ((ifr->dwType == MIB_IF_TYPE_ETHERNET) ||
(ifr->dwType == IF_TYPE_IEEE80211)) (ifr->dwType == IF_TYPE_IEEE80211))
{ {
if(strstr(ifr->bDescr, "Scheduler") == NULL if ((strstr(ifr->bDescr, "Scheduler") == NULL) &&
&& strstr(ifr->bDescr, "Filter") == NULL) { (strstr(ifr->bDescr, "Filter") == NULL))
friendly = sigar_net_interface_name_get(sigar, ifr, address_list); {
} friendly = sigar_net_interface_name_get(sigar, ifr, address_list);
}
if(friendly == NULL) {
snprintf(name, ifr->dwDescrLen, "%s", ifr->bDescr); if (friendly == NULL) {
} else { snprintf(name, ifr->dwDescrLen, "%s", ifr->bDescr);
snprintf(name, MAX_INTERFACE_NAME_LEN, "%s", friendly); }
} else {
name[MAX_INTERFACE_NAME_LEN] = 0; snprintf(name, MAX_INTERFACE_NAME_LEN, "%s", friendly);
free(friendly); }
name[MAX_INTERFACE_NAME_LEN] = 0;
free(friendly);
} }
else { else {
continue; /*XXX*/ continue; /*XXX*/