You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by fp...@apache.org on 2013/08/21 11:53:37 UTC
svn commit: r1516126 - in /zookeeper/trunk: CHANGES.txt src/c/Makefile.am
src/c/src/cli.c src/c/src/zookeeper.c
Author: fpj
Date: Wed Aug 21 09:53:37 2013
New Revision: 1516126
URL: http://svn.apache.org/r1516126
Log:
ZOOKEEPER-1679. c client: use -Wdeclaration-after-statement (michi via fpj)
Modified:
zookeeper/trunk/CHANGES.txt
zookeeper/trunk/src/c/Makefile.am
zookeeper/trunk/src/c/src/cli.c
zookeeper/trunk/src/c/src/zookeeper.c
Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1516126&r1=1516125&r2=1516126&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Wed Aug 21 09:53:37 2013
@@ -547,6 +547,8 @@ IMPROVEMENTS:
ZOOKEEPER-1400. Allow logging via callback instead of raw FILE pointer (michi via fpj)
+ ZOOKEEPER-1679. c client: use -Wdeclaration-after-statement (michi via fpj)
+
Release 3.4.0 -
Non-backward compatible changes:
Modified: zookeeper/trunk/src/c/Makefile.am
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/Makefile.am?rev=1516126&r1=1516125&r2=1516126&view=diff
==============================================================================
--- zookeeper/trunk/src/c/Makefile.am (original)
+++ zookeeper/trunk/src/c/Makefile.am Wed Aug 21 09:53:37 2013
@@ -2,7 +2,7 @@
include $(top_srcdir)/aminclude.am
AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated
-AM_CFLAGS = -Wall -Werror
+AM_CFLAGS = -Wall -Werror -Wdeclaration-after-statement
AM_CXXFLAGS = -Wall $(USEIPV6)
LIB_LDFLAGS = -no-undefined -version-info 2
Modified: zookeeper/trunk/src/c/src/cli.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/cli.c?rev=1516126&r1=1516125&r2=1516126&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/cli.c (original)
+++ zookeeper/trunk/src/c/src/cli.c Wed Aug 21 09:53:37 2013
@@ -362,9 +362,8 @@ void processline(char *line) {
fprintf(stderr, "Error %d for %s\n", rc, line);
}
} else if (startsWith(line, "reconfig ")) {
- line += 9;
int syntaxError = 0;
-
+ char* p = NULL;
char* joining = NULL;
char* leaving = NULL;
char* members = NULL;
@@ -373,8 +372,8 @@ void processline(char *line) {
int mode = 0; // 0 = not set, 1 = incremental, 2 = non-incremental
int64_t version = -1;
- char *p = strtok (strdup(line)," ");
-
+ line += 9;
+ p = strtok (strdup(line)," ");
while (p != NULL) {
if (strcmp(p, "-add")==0) {
p = strtok (NULL," ");
@@ -401,13 +400,14 @@ void processline(char *line) {
mode = 2;
members = strdup(p);
} else if (strcmp(p, "-file")==0){
+ FILE *fp = NULL;
p = strtok (NULL," ");
if (mode == 1 || p == NULL) {
syntaxError = 1;
break;
}
mode = 2;
- FILE *fp = fopen(p, "r");
+ fp = fopen(p, "r");
if (fp == NULL) {
fprintf(stderr, "Error reading file: %s\n", p);
syntaxError = 1;
@@ -444,7 +444,11 @@ void processline(char *line) {
syntaxError = 1;
break;
}
+#ifdef WIN32
+ version = _strtoui64(p, NULL, 16);
+#else
version = strtoull(p, NULL, 16);
+#endif
if (version < 0) {
syntaxError = 1;
break;
Modified: zookeeper/trunk/src/c/src/zookeeper.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zookeeper.c?rev=1516126&r1=1516125&r2=1516126&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ zookeeper/trunk/src/c/src/zookeeper.c Wed Aug 21 09:53:37 2013
@@ -3841,6 +3841,9 @@ int flush_send_queue(zhandle_t*zh, int t
lock_buffer_list(&zh->to_send);
while (zh->to_send.head != 0&& zh->state == ZOO_CONNECTED_STATE) {
if(timeout!=0){
+#ifndef WIN32
+ struct pollfd fds;
+#endif
int elapsed;
struct timeval now;
gettimeofday(&now,0);
@@ -3857,7 +3860,6 @@ int flush_send_queue(zhandle_t*zh, int t
// Poll the socket
rc = select((int)(zh->fd)+1, NULL, &pollSet, NULL, &wait);
#else
- struct pollfd fds;
fds.fd = zh->fd;
fds.events = POLLOUT;
fds.revents = 0;