Permalink
Browse files

make reformat

Change-Id: I0c5b6e23c32fb641c98636377d1fe5032a6620a8
Reviewed-on: http://review.couchbase.org/13781
Tested-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information...
1 parent c7330f8 commit 2b7cd18af562775005a133698433b1fe3d61ec7d @avsej avsej committed with trondn Mar 5, 2012
View
@@ -37,12 +37,15 @@
#include <libcouchbase/couchbase.h>
static void usage(char cmd, const void *arg, void *cookie);
-static void set_flag(char cmd, const void *arg, void *cookie) {
- (void)cmd; (void)arg;
+static void set_flag(char cmd, const void *arg, void *cookie)
+{
+ (void)cmd;
+ (void)arg;
*((int *)cookie) = 1;
}
-static void set_char_ptr(char cmd, const void *arg, void *cookie) {
+static void set_char_ptr(char cmd, const void *arg, void *cookie)
+{
const char **myptr = cookie;
*myptr = arg;
(void)cmd;
@@ -53,14 +56,15 @@ const char *username = NULL;
const char *passwd = NULL;
const char *bucket = NULL;
const char *filename = "-";
-const char *post_data= NULL;
+const char *post_data = NULL;
int chunked = 0;
struct cookie_st {
struct libcouchbase_io_opt_st *io;
};
-static void set_auth_data(char cmd, const void *arg, void *cookie) {
+static void set_auth_data(char cmd, const void *arg, void *cookie)
+{
(void)cmd;
(void)cookie;
username = arg;
@@ -161,7 +165,8 @@ static struct {
* @param argc Argument count
* @param argv Argument vector
*/
-static void handle_options(int argc, char **argv) {
+static void handle_options(int argc, char **argv)
+{
struct option opts[256] = { [0] = { .name = NULL } };
int ii = 0;
char shortopts[128] = { 0 };
@@ -170,7 +175,7 @@ static void handle_options(int argc, char **argv) {
int c;
for (ii = 0; ii < 256; ++ii) {
if (my_options[ii].name != NULL) {
- opts[jj].name = (char*)my_options[ii].name;
+ opts[jj].name = (char *)my_options[ii].name;
opts[jj].has_arg = my_options[ii].argument ? required_argument : no_argument;
opts[jj].val = my_options[ii].letter;
@@ -206,7 +211,10 @@ static void data_callback(libcouchbase_t instance,
if (bytes == NULL) { /* end of response */
c->io->stop_event_loop(c->io);
}
- (void)instance; (void)uri; (void)error; (void)status;
+ (void)instance;
+ (void)uri;
+ (void)error;
+ (void)status;
}
static void complete_callback(libcouchbase_t instance,
@@ -276,7 +284,7 @@ int main(int argc, char **argv)
return 1;
}
instance = libcouchbase_create(host, username,
- passwd, bucket, cookie.io);
+ passwd, bucket, cookie.io);
if (instance == NULL) {
fprintf(stderr, "Failed to create libcouchbase instance\n");
return 1;
View
@@ -44,12 +44,15 @@
#include <yajl/yajl_gen.h>
static void usage(char cmd, const void *arg, void *cookie);
-static void set_flag(char cmd, const void *arg, void *cookie) {
- (void)cmd; (void)arg;
+static void set_flag(char cmd, const void *arg, void *cookie)
+{
+ (void)cmd;
+ (void)arg;
*((int *)cookie) = 1;
}
-static void set_char_ptr(char cmd, const void *arg, void *cookie) {
+static void set_char_ptr(char cmd, const void *arg, void *cookie)
+{
(void)cmd;
const char **myptr = cookie;
*myptr = arg;
@@ -60,7 +63,7 @@ const char *username = NULL;
const char *passwd = NULL;
const char *bucket = NULL;
const char *filename = "-";
-const char *post_data= NULL;
+const char *post_data = NULL;
int chunked = 0;
int minify = 0;
int force_utf8 = 0;
@@ -71,7 +74,8 @@ struct cookie_st {
yajl_gen gen;
};
-static void set_auth_data(char cmd, const void *arg, void *cookie) {
+static void set_auth_data(char cmd, const void *arg, void *cookie)
+{
(void)cmd;
(void)cookie;
username = arg;
@@ -187,15 +191,16 @@ static struct {
* @param argc Argument count
* @param argv Argument vector
*/
-static void handle_options(int argc, char **argv) {
+static void handle_options(int argc, char **argv)
+{
struct option opts[256] = { [0] = { .name = NULL } };
int ii = 0;
char shortopts[128] = { 0 };
int jj = 0;
int kk = 0;
for (ii = 0; ii < 256; ++ii) {
if (my_options[ii].name != NULL) {
- opts[jj].name = (char*)my_options[ii].name;
+ opts[jj].name = (char *)my_options[ii].name;
opts[jj].has_arg = my_options[ii].argument ? required_argument : no_argument;
opts[jj].val = my_options[ii].letter;
@@ -322,7 +327,10 @@ static void data_callback(libcouchbase_t instance,
}
c->io->stop_event_loop(c->io);
}
- (void)instance; (void)uri; (void)error; (void)status;
+ (void)instance;
+ (void)uri;
+ (void)error;
+ (void)status;
}
static void complete_callback(libcouchbase_t instance,
View
@@ -30,23 +30,23 @@
using namespace std;
-class Configuration {
+class Configuration
+{
public:
- Configuration() : host(),
+ Configuration() : host(),
maxKey(1000),
iterations(1000),
fixedSize(true),
setprc(33),
prefix(""),
maxSize(1024),
- numThreads(1)
- {
+ numThreads(1) {
// @todo initialize the random sequence in seqno
- data = static_cast<void*>(new char[maxSize]);
+ data = static_cast<void *>(new char[maxSize]);
}
~Configuration() {
- delete []static_cast<char*>(data);
+ delete []static_cast<char *>(data);
}
const char *getHost() const {
@@ -142,7 +142,8 @@ extern "C" {
libcouchbase_uint32_t);
}
-class ThreadContext {
+class ThreadContext
+{
public:
ThreadContext() :
currSeqno(0), instance(NULL) {
@@ -218,13 +219,13 @@ class ThreadContext {
config.maxSize, flags,
exp, 0);
} else {
- const char* keys[1];
+ const char *keys[1];
libcouchbase_size_t nkey[1];
keys[0] = key.c_str();
nkey[0] = (libcouchbase_size_t)key.length();
if (libcouchbase_mget(instance, this, 1,
- reinterpret_cast<const void * const *>(keys), nkey, NULL)
- != LIBCOUCHBASE_SUCCESS) {
+ reinterpret_cast<const void *const *>(keys), nkey, NULL)
+ != LIBCOUCHBASE_SUCCESS) {
// @error
}
}
@@ -263,7 +264,7 @@ class ThreadContext {
generateKey(key, ii);
error = libcouchbase_store(instance,
- reinterpret_cast<void*> (this), LIBCOUCHBASE_SET,
+ reinterpret_cast<void *> (this), LIBCOUCHBASE_SET,
key.c_str(),
(libcouchbase_size_t)key.length(),
config.data, config.maxSize, 0, 0, 0);
@@ -304,7 +305,7 @@ class ThreadContext {
std::stringstream ss;
ss << header << std::endl;
ss << " +---------+---------+---------+---------+" << std::endl;
- libcouchbase_get_timings(instance, reinterpret_cast<void*> (&ss),
+ libcouchbase_get_timings(instance, reinterpret_cast<void *> (&ss),
timingsCallback);
ss << " +----------------------------------------" << endl;
std::cout << ss.str();
@@ -341,19 +342,21 @@ class ThreadContext {
static void storageCallback(libcouchbase_t, const void *cookie,
libcouchbase_storage_t, libcouchbase_error_t error,
- const void *, libcouchbase_size_t, libcouchbase_cas_t) {
+ const void *, libcouchbase_size_t, libcouchbase_cas_t)
+{
ThreadContext *tc;
- tc = const_cast<ThreadContext*>(reinterpret_cast<const ThreadContext*>(cookie));
+ tc = const_cast<ThreadContext *>(reinterpret_cast<const ThreadContext *>(cookie));
tc->setError(error);
}
static void getCallback(libcouchbase_t, const void *cookie,
libcouchbase_error_t error, const void *,
libcouchbase_size_t, const void *,
libcouchbase_size_t, libcouchbase_uint32_t,
- libcouchbase_cas_t) {
+ libcouchbase_cas_t)
+{
ThreadContext *tc;
- tc = const_cast<ThreadContext*>(reinterpret_cast<const ThreadContext*>(cookie));
+ tc = const_cast<ThreadContext *>(reinterpret_cast<const ThreadContext *>(cookie));
tc->setError(error);
}
@@ -363,9 +366,10 @@ static void timingsCallback(libcouchbase_t instance, const void *cookie,
libcouchbase_uint32_t min,
libcouchbase_uint32_t max,
libcouchbase_uint32_t total,
- libcouchbase_uint32_t maxtotal) {
+ libcouchbase_uint32_t maxtotal)
+{
std::stringstream *ss =
- const_cast<std::stringstream*> (reinterpret_cast<const std::stringstream*> (cookie));
+ const_cast<std::stringstream *> (reinterpret_cast<const std::stringstream *> (cookie));
char buffer[1024];
int offset = sprintf(buffer, "[%3u - %3u]", min, max);
@@ -400,7 +404,8 @@ static void timingsCallback(libcouchbase_t instance, const void *cookie,
(void)instance;
}
-static void handle_options(int argc, char **argv) {
+static void handle_options(int argc, char **argv)
+{
Getopt getopt;
getopt.addOption(new CommandLineOption('?', "help", false,
"Print this help text"));
@@ -424,7 +429,7 @@ static void handle_options(int argc, char **argv) {
exit(EXIT_FAILURE);
}
- std::vector<CommandLineOption*>::iterator iter;
+ std::vector<CommandLineOption *>::iterator iter;
for (iter = getopt.options.begin(); iter != getopt.options.end(); ++iter) {
if ((*iter)->found) {
switch ((*iter)->shortopt) {
@@ -477,7 +482,8 @@ static void handle_options(int argc, char **argv) {
* @param argv argument vector
* @return 0 success, 1 failure
*/
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
handle_options(argc, argv);
ThreadContext ctx;
@@ -61,12 +61,12 @@ extern "C" {
const void *key,
libcouchbase_size_t nkey);
typedef void (*libcouchbase_stat_callback)(libcouchbase_t instance,
- const void* cookie,
- const char* server_endpoint,
+ const void *cookie,
+ const char *server_endpoint,
libcouchbase_error_t error,
- const void* key,
+ const void *key,
libcouchbase_size_t nkey,
- const void* bytes,
+ const void *bytes,
libcouchbase_size_t nbytes);
typedef void (*libcouchbase_version_callback)(libcouchbase_t instance,
const void *cookie,
@@ -118,8 +118,8 @@ extern "C" {
const char *errinfo);
typedef void (*libcouchbase_flush_callback)(libcouchbase_t instance,
- const void* cookie,
- const char* server_endpoint,
+ const void *cookie,
+ const char *server_endpoint,
libcouchbase_error_t error);
/**
@@ -188,15 +188,15 @@ extern "C" {
LIBCOUCHBASE_API
libcouchbase_tap_flush_callback libcouchbase_set_tap_flush_callback(libcouchbase_t,
- libcouchbase_tap_flush_callback);
+ libcouchbase_tap_flush_callback);
LIBCOUCHBASE_API
libcouchbase_tap_opaque_callback libcouchbase_set_tap_opaque_callback(libcouchbase_t,
libcouchbase_tap_opaque_callback);
LIBCOUCHBASE_API
libcouchbase_tap_vbucket_set_callback libcouchbase_set_tap_vbucket_set_callback(libcouchbase_t,
- libcouchbase_tap_vbucket_set_callback);
+ libcouchbase_tap_vbucket_set_callback);
LIBCOUCHBASE_API
libcouchbase_error_callback libcouchbase_set_error_callback(libcouchbase_t,
@@ -31,9 +31,10 @@
extern "C" {
#endif
- typedef enum {
+ enum libcouchbase_cluster_t {
LIBCOUCHBASE_MEMCACHED_CLUSTER = 0x00
- } libcouchbase_cluster_t;
+ };
+ typedef enum libcouchbase_cluster_t libcouchbase_cluster_t;
LIBCOUCHBASE_API
libcouchbase_error_t libcouchbase_create_compat(libcouchbase_cluster_t type,
Oops, something went wrong.

0 comments on commit 2b7cd18

Please sign in to comment.