~mdw
/
disorder
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use private *printf functions a bit more widely.
[disorder]
/
lib
/
addr.c
diff --git
a/lib/addr.c
b/lib/addr.c
index
d1c9d01
..
5bc5bdf
100644
(file)
--- a/
lib/addr.c
+++ b/
lib/addr.c
@@
-232,6
+232,8
@@
int netaddress_parse(struct netaddress *na,
int nvec,
char **vec) {
const char *port;
int nvec,
char **vec) {
const char *port;
+ long p;
+ int e;
na->af = AF_UNSPEC;
if(nvec > 0 && vec[0][0] == '-') {
na->af = AF_UNSPEC;
if(nvec > 0 && vec[0][0] == '-') {
@@
-282,8
+284,7
@@
int netaddress_parse(struct netaddress *na,
}
if(port[strspn(port, "0123456789")])
return -1;
}
if(port[strspn(port, "0123456789")])
return -1;
- long p;
- int e = xstrtol(&p, port, NULL, 10);
+ e = xstrtol(&p, port, NULL, 10);
if(e)
return -1;
if(e)
return -1;
@@
-320,7
+321,7
@@
void netaddress_format(const struct netaddress *na,
if(na->port != -1) {
char buffer[64];
if(na->port != -1) {
char buffer[64];
- snprintf(buffer, sizeof buffer, "%d", na->port);
+
byte_
snprintf(buffer, sizeof buffer, "%d", na->port);
vector_append(v, xstrdup(buffer));
}
vector_terminate(v);
vector_append(v, xstrdup(buffer));
}
vector_terminate(v);
@@
-348,7
+349,7
@@
struct addrinfo *netaddress_resolve(const struct netaddress *na,
hints->ai_family = na->af;
hints->ai_protocol = protocol;
hints->ai_flags = passive ? AI_PASSIVE : 0;
hints->ai_family = na->af;
hints->ai_protocol = protocol;
hints->ai_flags = passive ? AI_PASSIVE : 0;
- snprintf(service, sizeof service, "%d", na->port);
+
byte_
snprintf(service, sizeof service, "%d", na->port);
rc = getaddrinfo(na->address, service, hints, &res);
if(rc) {
disorder_error(0, "getaddrinfo %s %d: %s",
rc = getaddrinfo(na->address, service, hints, &res);
if(rc) {
disorder_error(0, "getaddrinfo %s %d: %s",