Skip to content

Commit

Permalink
Merge pull request RedisLabs#103 from computerphilosopher/whitespace
Browse files Browse the repository at this point in the history
remove unnecessary whitespaces
  • Loading branch information
yossigo authored Nov 26, 2019
2 parents 9d8b43a + 51b7ba7 commit f55b4b6
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 115 deletions.
18 changes: 9 additions & 9 deletions JSON_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ json_handler::json_handler(const char * jsonfilename) : m_json_file(NULL)
m_json_file = fopen(jsonfilename, "w");
if (!m_json_file) {
perror(jsonfilename);
}
}
// opening the JSON
fprintf(stderr, "Json file %s created...\n", jsonfilename);
fprintf(m_json_file,"{");
fprintf(m_json_file,"{");
m_nest_closer_types.push_back(NESTED_GENERAL);
beutify();
beutify();
}

/**
Expand All @@ -57,7 +57,7 @@ json_handler::~json_handler()
}
}

/**
/**
* Write singel object named objectname to the JSON with values stated in ...
* based on the format defined
* basically uses fprintf with the same parameters.
Expand All @@ -73,7 +73,7 @@ void json_handler::write_obj(const char * objectname, const char * format, ...)
fprintf(m_json_file, ",");
}

/**
/**
* Starts a nesting with a title as defined in objectname
* in case objectname == NULL it will not add the title and just start nesting
* The type defines the kind of charecters that will be used
Expand All @@ -90,9 +90,9 @@ void json_handler::open_nesting(const char * objectname,eJSON_NESTED_TYPE type /
beutify(false);
}

/**
/**
* Ends the nesting
* Closes the nesting based on the nesting list
* Closes the nesting based on the nesting list
* Returns = the nested levels left after the closing
*/
int json_handler::close_nesting()
Expand All @@ -115,7 +115,7 @@ int json_handler::close_nesting()
return m_nest_closer_types.size();
}

/**
/**
* Add tabls and new line (if only_tabs==true will only add tabs)
*/
void json_handler::beutify(bool only_tabs)
Expand All @@ -129,5 +129,5 @@ void json_handler::beutify(bool only_tabs)
{
fprintf(m_json_file, "\t");
}

}
10 changes: 5 additions & 5 deletions JSON_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ typedef enum{
NESTED_ARRAY // []
}eJSON_NESTED_TYPE;

/** represents an JSON handler, At this phase, only writes to JSON. */
/** represents an JSON handler, At this phase, only writes to JSON. */
class json_handler {
protected:
FILE * m_json_file;
FILE * m_json_file;
// This list is used later for closing the nesting
std::list<eJSON_NESTED_TYPE> m_nest_closer_types;
void beutify(bool only_tabs = false);
public:
json_handler(const char * jsonfilename);
~json_handler();

// Write a single object to JSON
void write_obj(const char * objectname, const char * format, ...);

// Starts nesting, the type is used for deciding which charecter to be used for opening and closing
// Starts nesting, the type is used for deciding which charecter to be used for opening and closing
// the nesting ('{}','[]')
void open_nesting(const char * objectname,eJSON_NESTED_TYPE type = NESTED_GENERAL);

// returns the nested level left after closing
int close_nesting();
};
Expand Down
20 changes: 10 additions & 10 deletions client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ client::client(struct event_base *event_base, benchmark_config *config,
if (!setup_client(config, protocol, obj_gen)) {
return;
}

benchmark_debug_log("new client %p successfully set up.\n", this);
m_initialized = true;
}
Expand Down Expand Up @@ -203,7 +203,7 @@ bool client::finished(void)
return true;
if (m_config->test_time > 0 && m_stats.get_duration() >= m_config->test_time)
return true;
return false;
return false;
}

void client::set_start_time() {
Expand Down Expand Up @@ -333,7 +333,7 @@ void client::create_request(struct timeval timestamp, unsigned int conn_id)

assert(key != NULL);
assert(keylen > 0);

m_keylist->add_key(key, keylen);
}

Expand All @@ -353,14 +353,14 @@ void client::create_request(struct timeval timestamp, unsigned int conn_id)
} else {
// overlap counters
m_get_ratio_count = m_set_ratio_count = 0;
}
}
}

int client::prepare(void)
{
if (MAIN_CONNECTION == NULL)
return -1;

int ret = this->connect();
if (ret < 0) {
benchmark_error_log("prepare: failed to connect, test aborted.\n");
Expand Down Expand Up @@ -522,7 +522,7 @@ bool verify_client::finished(void)

///////////////////////////////////////////////////////////////////////////

client_group::client_group(benchmark_config* config, abstract_protocol *protocol, object_generator* obj_gen) :
client_group::client_group(benchmark_config* config, abstract_protocol *protocol, object_generator* obj_gen) :
m_base(NULL), m_config(config), m_protocol(protocol), m_obj_gen(obj_gen)
{
m_base = event_base_new();
Expand Down Expand Up @@ -561,7 +561,7 @@ int client_group::create_clients(int num)
delete c;
return i;
}

m_clients.push_back(c);
}

Expand Down Expand Up @@ -625,14 +625,14 @@ unsigned long int client_group::get_duration_usec(void)
float factor = ((float)(thread_counter - 1) / thread_counter);
duration = factor * duration + (float)(*i)->get_stats()->get_duration_usec() / thread_counter ;
}

return duration;
}

void client_group::merge_run_stats(run_stats* target)
{
assert(target != NULL);
unsigned int iteration_counter = 1;
unsigned int iteration_counter = 1;
for (std::vector<client*>::iterator i = m_clients.begin(); i != m_clients.end(); i++) {
target->merge(*(*i)->get_stats(), iteration_counter++);
}
Expand All @@ -649,5 +649,5 @@ void client_group::write_client_stats(const char *prefix)
if (!(*i)->get_stats()->save_csv(filename, m_config)) {
fprintf(stderr, "error: %s: failed to write client stats.\n", filename);
}
}
}
}
8 changes: 4 additions & 4 deletions config_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ config_ratio::config_ratio(const char *ratio_str) :
if (!q || *q != '\0') {
a = b = 0;
return;
}
}
}

config_weight_list::config_weight_list() :
Expand All @@ -98,7 +98,7 @@ config_weight_list::config_weight_list(const config_weight_list& copy) :
for (std::vector<weight_item>::const_iterator i = copy.item_list.begin(); i != copy.item_list.end(); i++) {
const weight_item wi = *i;
item_list.push_back(wi);
}
}
next_size_iter = item_list.begin();
}

Expand All @@ -111,7 +111,7 @@ config_weight_list& config_weight_list::operator=(const config_weight_list& rhs)
for (std::vector<weight_item>::const_iterator i = rhs.item_list.begin(); i != rhs.item_list.end(); i++) {
const weight_item wi = *i;
item_list.push_back(wi);
}
}
next_size_iter = item_list.begin();
return *this;
}
Expand Down Expand Up @@ -184,7 +184,7 @@ const char* config_weight_list::print(char *buf, int buf_len)

*buf = '\0';
for (std::vector<weight_item>::iterator i = item_list.begin(); i != item_list.end(); i++) {
int n = snprintf(buf, buf_len, "%s%u:%u",
int n = snprintf(buf, buf_len, "%s%u:%u",
i != item_list.begin() ? "," : "", i->size, i->weight);
buf += n;
buf_len -= n;
Expand Down
4 changes: 2 additions & 2 deletions config_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct config_weight_list {
unsigned int size;
unsigned int weight;
};

std::vector<weight_item> item_list;
std::vector<weight_item>::iterator next_size_iter;
unsigned int next_size_weight;
Expand All @@ -60,7 +60,7 @@ struct config_weight_list {
config_weight_list(const char* str);
config_weight_list(const config_weight_list& copy);
config_weight_list& operator=(const config_weight_list& rhs);

bool is_defined(void);
unsigned int largest(void);
const char *print(char *buf, int buf_len);
Expand Down
Loading

0 comments on commit f55b4b6

Please sign in to comment.