UPnP: Minor coding style cleanup

This commit is contained in:
Jouni Malinen 2009-02-03 13:25:49 +02:00 committed by Jouni Malinen
parent c0a0c97aa9
commit e80e5163f8
4 changed files with 10 additions and 11 deletions

View File

@ -567,9 +567,8 @@ void subscription_unlink(struct subscription *s)
/* only one? */ /* only one? */
sm->subscriptions = NULL; sm->subscriptions = NULL;
} else { } else {
if (sm->subscriptions == s) { if (sm->subscriptions == s)
sm->subscriptions = s->next; sm->subscriptions = s->next;
}
s->next->prev = s->prev; s->next->prev = s->prev;
s->prev->next = s->next; s->prev->next = s->next;
} }
@ -856,7 +855,8 @@ static int get_netif_info(const char *net_if, unsigned *ip_addr,
if (*ip_addr_text == NULL || *mac_addr_text == NULL) if (*ip_addr_text == NULL || *mac_addr_text == NULL)
goto fail; goto fail;
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
goto fail; goto fail;
os_strncpy(req.ifr_name, net_if, sizeof(req.ifr_name)); os_strncpy(req.ifr_name, net_if, sizeof(req.ifr_name));

View File

@ -400,8 +400,7 @@ static int event_send_start(struct subscription *s)
*/ */
if (connect(e->sd, (struct sockaddr *) &e->addr->saddr, if (connect(e->sd, (struct sockaddr *) &e->addr->saddr,
sizeof(e->addr->saddr))) { sizeof(e->addr->saddr))) {
if (errno == EINPROGRESS) { if (errno != EINPROGRESS) {
} else {
event_retry(e, 1); event_retry(e, 1);
return -1; return -1;
} }
@ -432,7 +431,8 @@ void event_send_all_later_handler(void *eloop_data, void *user_ctx)
int nerrors = 0; int nerrors = 0;
sm->event_send_all_queued = 0; sm->event_send_all_queued = 0;
if ((s = sm->subscriptions) == NULL) s = sm->subscriptions;
if (s == NULL)
return; return;
do { do {
if (s->addr_list == NULL) { if (s->addr_list == NULL) {

View File

@ -51,7 +51,7 @@ static int token_eq(const char *s1, const char *s2)
if (end1 || end2 || c1 != c2) if (end1 || end2 || c1 != c2)
break; break;
} }
return (end1 && end2); /* reached end of both words? */ return end1 && end2; /* reached end of both words? */
} }
@ -359,10 +359,9 @@ void msearchreply_state_machine_stop(struct advertisement_state_machine *a)
wpa_printf(MSG_DEBUG, "WPS UPnP: M-SEARCH stop"); wpa_printf(MSG_DEBUG, "WPS UPnP: M-SEARCH stop");
if (a->next == a) { if (a->next == a) {
sm->msearch_replies = NULL; sm->msearch_replies = NULL;
} else { } else {
if (sm->msearch_replies == a) { if (sm->msearch_replies == a)
sm->msearch_replies = a->next; sm->msearch_replies = a->next;
}
a->next->prev = a->prev; a->next->prev = a->prev;
a->prev->next = a->next; a->prev->next = a->next;
} }

View File

@ -253,7 +253,7 @@ upnp_get_first_document_item(char *doc, const char *item, char **value)
if (!os_strncasecmp(tagname, match, match_len) && if (!os_strncasecmp(tagname, match, match_len) &&
*tag != '/' && *tag != '/' &&
(tagname[match_len] == '>' || (tagname[match_len] == '>' ||
!isgraph(tagname[match_len]) )) { !isgraph(tagname[match_len]))) {
break; break;
} }
} }