Permalink
Browse files

Reformat code and reorder .gitignore

Change-Id: I2b9f919472126424fd0d17e49b956b03d8472546
Reviewed-on: http://review.couchbase.org/22304
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent 4f0c2a9 commit 2f28141c40f0a39385bac81726e044ffdcea2ebe @avsej avsej committed with trondn Nov 6, 2012
Showing with 38 additions and 39 deletions.
  1. +5 −5 .gitignore
  2. +25 −26 src/http.c
  3. +5 −5 src/instance.c
  4. +1 −1 src/timer.c
  5. +2 −2 tests/strerror-unit-test.cc
View
@@ -13,8 +13,8 @@
*.obj
*.orig
*.profile
-*.swp
*.swo
+*.swp
*~
._*
.deps/
@@ -37,11 +37,11 @@
/config/mkinstalldirs
/config/plugin.ac
/configure
-/example/yajl/couchview
-/example/pillowfight/pillowfight
-/example/syncmode/syncmode
/example/libeventdirect/eventloop
/example/minimal/minimal
+/example/pillowfight/pillowfight
+/example/syncmode/syncmode
+/example/yajl/couchview
/gtest-1.6.0
/gtest-1.6.0.zip
/include/libcouchbase/configuration.h
@@ -61,8 +61,8 @@
/src/config.h.in
/src/stamp-h1
/tests/*-test
-/tests/unit-tests
/tests/CouchbaseMock.jar
+/tests/unit-tests
/tools/cbc
/vc100.idb
/vc100.pdb
View
@@ -374,8 +374,8 @@ static void request_connect_handler(lcb_socket_t sock, short which, void *arg)
static void request_connected(lcb_http_request_t req)
{
req->io->v.v0.update_event(req->io, req->sock,
- req->event, LCB_WRITE_EVENT,
- req, request_event_handler);
+ req->event, LCB_WRITE_EVENT,
+ req, request_event_handler);
}
static lcb_error_t request_connect(lcb_http_request_t req)
@@ -521,33 +521,32 @@ lcb_error_t lcb_make_http_request(lcb_t instance,
req->on_complete = instance->callbacks.http_complete;
req->on_data = instance->callbacks.http_data;
switch (type) {
- case LCB_HTTP_TYPE_VIEW:
- {
- lcb_server_t *server;
- if (instance->type != LCB_TYPE_BUCKET) {
- return lcb_synchandler_return(instance, LCB_EINVAL);
- }
- /* pick random server */
- nn = (lcb_size_t)(gethrtime() >> 10) % instance->nservers;
- server = instance->servers + nn;
- if (!server->couch_api_base) {
+ case LCB_HTTP_TYPE_VIEW: {
+ lcb_server_t *server;
+ if (instance->type != LCB_TYPE_BUCKET) {
+ return lcb_synchandler_return(instance, LCB_EINVAL);
+ }
+ /* pick random server */
+ nn = (lcb_size_t)(gethrtime() >> 10) % instance->nservers;
+ server = instance->servers + nn;
+ if (!server->couch_api_base) {
+ lcb_http_request_destroy(req);
+ return lcb_synchandler_return(instance, LCB_NOT_SUPPORTED);
+ }
+ req->server = server;
+ base = server->couch_api_base;
+ nbase = strlen(base);
+ username = instance->sasl.name;
+ if (instance->sasl.password.secret.len) {
+ req->password = calloc(instance->sasl.password.secret.len + 1, sizeof(char));
+ if (!req->password) {
lcb_http_request_destroy(req);
- return lcb_synchandler_return(instance, LCB_NOT_SUPPORTED);
- }
- req->server = server;
- base = server->couch_api_base;
- nbase = strlen(base);
- username = instance->sasl.name;
- if (instance->sasl.password.secret.len) {
- req->password = calloc(instance->sasl.password.secret.len + 1, sizeof(char));
- if (!req->password) {
- lcb_http_request_destroy(req);
- return lcb_synchandler_return(instance, LCB_CLIENT_ENOMEM);
- }
- memcpy(req->password, instance->sasl.password.secret.data, instance->sasl.password.secret.len);
+ return lcb_synchandler_return(instance, LCB_CLIENT_ENOMEM);
}
+ memcpy(req->password, instance->sasl.password.secret.data, instance->sasl.password.secret.len);
}
- break;
+ }
+ break;
case LCB_HTTP_TYPE_MANAGEMENT:
nbase = strlen(instance->host) + strlen(instance->port) + 2;
View
@@ -1038,11 +1038,11 @@ static void lcb_instance_connect_handler(lcb_socket_t sock,
return ;
case LCB_CONNECT_EINPROGRESS:
instance->io->v.v0.update_event(instance->io,
- instance->sock,
- instance->event,
- LCB_WRITE_EVENT,
- instance,
- lcb_instance_connect_handler);
+ instance->sock,
+ instance->event,
+ LCB_WRITE_EVENT,
+ instance,
+ lcb_instance_connect_handler);
return ;
case LCB_CONNECT_EALREADY: /* Subsequent calls to connect */
return ;
View
@@ -63,7 +63,7 @@ lcb_timer_t lcb_timer_create(lcb_t instance,
return NULL;
}
instance->io->v.v0.update_timer(instance->io, tmr->event, tmr->usec,
- tmr, timer_callback);
+ tmr, timer_callback);
hashset_add(instance->timers, tmr);
@@ -33,8 +33,8 @@ TEST_F(Strerror, testNoCrash)
TEST_F(Strerror, allCodesDocumented)
{
- const char *generic = lcb_strerror(NULL, (lcb_error_t)-1);
- ASSERT_NE((const char*)NULL, generic);
+ const char *generic = lcb_strerror(NULL, (lcb_error_t) - 1);
+ ASSERT_NE((const char *)NULL, generic);
for (int ii = 0; ii < LCB_MAX_ERROR_VAL; ++ii) {
EXPECT_STRNE(generic,
lcb_strerror(NULL, (lcb_error_t)ii));

0 comments on commit 2f28141

Please sign in to comment.