From 0a97164db65d9b7298d9b1f771a08de2c199578e Mon Sep 17 00:00:00 2001 From: computerphilosopher Date: Fri, 9 Aug 2019 18:21:49 +0900 Subject: [PATCH] change int32_t to int --- cmd_in_second.c | 30 +++++++++++++++--------------- include/memcached/types.h | 2 +- memcached.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd_in_second.c b/cmd_in_second.c index ad1de85f1..0d9673a0f 100644 --- a/cmd_in_second.c +++ b/cmd_in_second.c @@ -27,18 +27,18 @@ typedef struct cmd_in_second_log { typedef struct cmd_in_second_buffer { logtype* ring; - int32_t front; - int32_t rear; - int32_t capacity; + int front; + int rear; + int capacity; } buffertype; typedef struct cmd_in_second_timer { struct timeval* ring; - int32_t front; - int32_t rear; - int32_t capacity; - int32_t last_elem_idx; - int32_t circular_counter; + int front; + int rear; + int capacity; + int last_elem_idx; + int circular_counter; } timertype; typedef struct cmd_in_second_flush_thread { @@ -54,8 +54,8 @@ struct cmd_in_second { char cmd_str[50]; struct cmd_in_second_buffer buffer; timertype timer; - int32_t bulk_limit; - int32_t log_per_timer; + int bulk_limit; + int log_per_timer; state cur_state; flush_thread flusher; pthread_mutex_t lock; @@ -123,7 +123,7 @@ static void wake_flusher_up(){ static void* flush_buffer() { - const int32_t fd = open("cmd_in_second.log", O_CREAT | O_WRONLY | O_TRUNC, 0644); + const int fd = open("cmd_in_second.log", O_CREAT | O_WRONLY | O_TRUNC, 0644); while(1) { if (fd < 0) { @@ -147,10 +147,10 @@ static void* flush_buffer() } const size_t cmd_len = strlen(this.cmd_str); - const int32_t whitespaces = 3; + const int whitespaces = 3; size_t expected_write_length = 0; - int32_t circular_log_counter = 0; + int circular_log_counter = 0; while (!buffer_empty()) { @@ -173,7 +173,7 @@ static void* flush_buffer() } sprintf(time_str, "%04d-%02d-%02d %02d:%02d:%02d.%06d\n", lt ->tm_year + 1900, lt->tm_mon + 1, lt->tm_mday, - lt->tm_hour, lt->tm_min, lt->tm_sec, (int32_t)front_time->tv_usec); + lt->tm_hour, lt->tm_min, lt->tm_sec, (int)front_time->tv_usec); expected_write_length += 27; } @@ -326,7 +326,7 @@ int cmd_in_second_start(const int operation, const char cmd_str[], const int bul this.operation = operation; this.bulk_limit = bulk_limit; - snprintf(this.cmd_str, CMD_STR_LEN, cmd_str); + snprintf(this.cmd_str, CMD_STR_LEN, "%s", cmd_str); this.buffer.capacity = bulk_limit+1; this.buffer.ring = (logtype*)malloc(this.buffer.capacity * sizeof(logtype)); diff --git a/include/memcached/types.h b/include/memcached/types.h index 481af7937..104cf2da1 100644 --- a/include/memcached/types.h +++ b/include/memcached/types.h @@ -38,7 +38,7 @@ struct iovec { #define SUPPORT_BOP_SMGET #define JHPARK_OLD_SMGET_INTERFACE #define MAX_EFLAG_COMPARE_COUNT 100 -#define CMD_IN_SECOND 1 +#define CMD_IN_SECOND #ifdef __cplusplus extern "C" { diff --git a/memcached.c b/memcached.c index c0fe1d842..763d7adc0 100644 --- a/memcached.c +++ b/memcached.c @@ -11686,7 +11686,7 @@ static void process_bop_arithmetic(conn *c, char *key, size_t nkey, bkey_range * } } else { cmd_in_second_write(OPERATION_BOP_DECR, key, c->client_ip); - + if (settings.detail_enabled) { stats_prefix_record_bop_decr(key, nkey, (ret==ENGINE_SUCCESS || ret==ENGINE_ELEM_ENOENT)); }