Skip to content

Commit 67f9d85

Browse files
ing-eokingjhpark816
authored andcommitted
INTERNAL: Rename prevtime_str variable to prefix_buf
1 parent 9db3135 commit 67f9d85

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

userlog_logger.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ static FILE *current_fp;
5959
static int current_flength; // current file length
6060
static char hname_pid[100]; // hostname + pid for prefix
6161
static int hname_len; // length of hname_pid
62-
static int prefix_len; // length of date_time + hname_pid
62+
static char prefix_buf[200];
63+
static int prefix_len; // length of date_time + hname_pid
6364
static bool reduction_mode; // duplication reduction or not. user setting or default(=False)
64-
static char prevtime_str[200];
6565
static char prev_log[2048];
6666
static int prev_len;
6767
static unsigned int loglimit_interval; // log rate limit time interval. user setting or default value
@@ -117,17 +117,17 @@ static void do_save_log(char *log_buf, int len)
117117
static void do_print_drop_begin_message(time_t cur_time)
118118
{
119119
char *tmpstr = " user_logger begins to drop messages due to rate-limiting\n";
120-
do_make_prefix(prevtime_str, cur_time);
121-
do_print_msg(prevtime_str, prefix_len, tmpstr, 60);
120+
do_make_prefix(prefix_buf, cur_time);
121+
do_print_msg(prefix_buf, prefix_len, tmpstr, 60);
122122
}
123123

124124
static void do_print_drop_stat_message(time_t cur_time, int drop_cnt)
125125
{
126126
char tmpbuf[128];
127127
int tmplen = sprintf(tmpbuf, " user_logger lost %d messages due to rate-limiting (%d)\n",
128128
drop_cnt, loglimit_burst);
129-
do_make_prefix(prevtime_str, cur_time);
130-
do_print_msg(prevtime_str, prefix_len, tmpbuf, tmplen);
129+
do_make_prefix(prefix_buf, cur_time);
130+
do_print_msg(prefix_buf, prefix_len, tmpbuf, tmplen);
131131
}
132132

133133
static bool do_userlog_internal(time_t cur_time, char *body_buf, int len)
@@ -144,15 +144,15 @@ static bool do_userlog_internal(time_t cur_time, char *body_buf, int len)
144144
// Two log messages are different. Print the count and the previous time,
145145
// then restart the count.
146146
if (samelog_cnt > 0) {
147-
do_make_prefix(prevtime_str, samelog_time);
148-
do_print_dup(prevtime_str, samelog_cnt);
147+
do_make_prefix(prefix_buf, samelog_time);
148+
do_print_dup(prefix_buf, samelog_cnt);
149149
samelog_cnt = 0;
150150
}
151151
do_save_log(body_buf, len);
152152
}
153153

154-
do_make_prefix(prevtime_str, cur_time);
155-
do_print_msg(prevtime_str, prefix_len, body_buf, len);
154+
do_make_prefix(prefix_buf, cur_time);
155+
do_print_msg(prefix_buf, prefix_len, body_buf, len);
156156
return true;
157157
}
158158

@@ -325,7 +325,7 @@ EXTENSION_ERROR_CODE memcached_extensions_initialize(const char *config,
325325
if (reduction_mode == true) { // default is false
326326
prev_log[0] = 0;
327327
prev_len = 0;
328-
prevtime_str[0] = 0;
328+
prefix_buf[0] = 0;
329329
}
330330
/* end of userlog codes */
331331

0 commit comments

Comments
 (0)