projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Require a compiler that understands C99
[collectd.git]
/
src
/
zookeeper.c
diff --git
a/src/zookeeper.c
b/src/zookeeper.c
index
5aa94e3
..
a3b7362
100644
(file)
--- a/
src/zookeeper.c
+++ b/
src/zookeeper.c
@@
-29,7
+29,6
@@
#include "plugin.h"
#include <netdb.h>
#include "plugin.h"
#include <netdb.h>
-#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@
-106,18
+105,19
@@
static int zookeeper_connect (void)
{
int sk = -1;
int status;
{
int sk = -1;
int status;
- struct addrinfo ai_hints;
struct addrinfo *ai;
struct addrinfo *ai_list;
struct addrinfo *ai;
struct addrinfo *ai_list;
- char *host;
- char *port;
-
- memset ((void *) &ai_hints, '\0', sizeof (ai_hints));
- ai_hints.ai_family = AF_UNSPEC;
- ai_hints.ai_socktype = SOCK_STREAM;
+ const char *host;
+ const char *port;
host = (zk_host != NULL) ? zk_host : ZOOKEEPER_DEF_HOST;
port = (zk_port != NULL) ? zk_port : ZOOKEEPER_DEF_PORT;
host = (zk_host != NULL) ? zk_host : ZOOKEEPER_DEF_HOST;
port = (zk_port != NULL) ? zk_port : ZOOKEEPER_DEF_PORT;
+
+ struct addrinfo ai_hints = {
+ .ai_family = AF_UNSPEC,
+ .ai_socktype = SOCK_STREAM
+ };
+
status = getaddrinfo (host, port, &ai_hints, &ai_list);
if (status != 0)
{
status = getaddrinfo (host, port, &ai_hints, &ai_list);
if (status != 0)
{
@@
-160,8
+160,7
@@
static int zookeeper_connect (void)
static int zookeeper_query (char *buffer, size_t buffer_size)
{
static int zookeeper_query (char *buffer, size_t buffer_size)
{
- int sk = -1;
- int status;
+ int sk, status;
size_t buffer_fill;
sk = zookeeper_connect();
size_t buffer_fill;
sk = zookeeper_connect();