mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
[CLEANUP] remove a warning from gcc due to htons() in standard.c
Due to the fact that htons is defined as a macro, it's dangerous to call it with auto-incremented arguments such as htons(f(++x)) : src/standard.c: In function 'url2sa': src/standard.c:291: warning: operation on 'curr' may be undefined The solution is simply to store the intermediate result an pass it to htons() at once.
This commit is contained in:
parent
b80c230f41
commit
d1cd276456
@ -288,7 +288,8 @@ int url2sa(const char *url, int ulen, struct sockaddr_in *addr)
|
||||
if (!ret)
|
||||
return -1;
|
||||
curr += ret;
|
||||
addr->sin_port = (*curr == ':') ? htons(str2uic(++curr)) : htons(80);
|
||||
addr->sin_port = (*curr == ':') ? str2uic(++curr) : 80;
|
||||
addr->sin_port = htons(addr->sin_port);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user