From 5a42883c27830f1053fe9b4f68f74c2f36f965b3 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Mon, 20 Apr 2020 15:46:27 +0200 Subject: [PATCH] log: Dont shadow logp Let's use another name. --- src/log.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/log.c b/src/log.c index f5c489e2..a76e6abd 100644 --- a/src/log.c +++ b/src/log.c @@ -485,32 +485,32 @@ _chat_log_chat(const char *const login, const char *const other, const char *con } gchar *date_fmt = g_date_time_format(timestamp, "%H:%M:%S"); - FILE *logp = fopen(dated_log->filename, "a"); + FILE *chatlogp = fopen(dated_log->filename, "a"); g_chmod(dated_log->filename, S_IRUSR | S_IWUSR); - if (logp) { + if (chatlogp) { if (direction == PROF_IN_LOG) { if (strncmp(msg, "/me ", 4) == 0) { if (resourcepart) { - fprintf(logp, "%s - *%s %s\n", date_fmt, resourcepart, msg + 4); + fprintf(chatlogp, "%s - *%s %s\n", date_fmt, resourcepart, msg + 4); } else { - fprintf(logp, "%s - *%s %s\n", date_fmt, other, msg + 4); + fprintf(chatlogp, "%s - *%s %s\n", date_fmt, other, msg + 4); } } else { if (resourcepart) { - fprintf(logp, "%s - %s: %s\n", date_fmt, resourcepart, msg); + fprintf(chatlogp, "%s - %s: %s\n", date_fmt, resourcepart, msg); } else { - fprintf(logp, "%s - %s: %s\n", date_fmt, other, msg); + fprintf(chatlogp, "%s - %s: %s\n", date_fmt, other, msg); } } } else { if (strncmp(msg, "/me ", 4) == 0) { - fprintf(logp, "%s - *me %s\n", date_fmt, msg + 4); + fprintf(chatlogp, "%s - *me %s\n", date_fmt, msg + 4); } else { - fprintf(logp, "%s - me: %s\n", date_fmt, msg); + fprintf(chatlogp, "%s - me: %s\n", date_fmt, msg); } } - fflush(logp); - int result = fclose(logp); + fflush(chatlogp); + int result = fclose(chatlogp); if (result == EOF) { log_error("Error closing file %s, errno = %d", dated_log->filename, errno); } @@ -599,17 +599,17 @@ _groupchat_log_chat(const gchar *const login, const gchar *const room, const gch gchar *date_fmt = g_date_time_format(dt, "%H:%M:%S"); - FILE *logp = fopen(dated_log->filename, "a"); + FILE *grpchatlogp = fopen(dated_log->filename, "a"); g_chmod(dated_log->filename, S_IRUSR | S_IWUSR); - if (logp) { + if (grpchatlogp) { if (strncmp(msg, "/me ", 4) == 0) { - fprintf(logp, "%s - *%s %s\n", date_fmt, nick, msg + 4); + fprintf(grpchatlogp, "%s - *%s %s\n", date_fmt, nick, msg + 4); } else { - fprintf(logp, "%s - %s: %s\n", date_fmt, nick, msg); + fprintf(grpchatlogp, "%s - %s: %s\n", date_fmt, nick, msg); } - fflush(logp); - int result = fclose(logp); + fflush(grpchatlogp); + int result = fclose(grpchatlogp); if (result == EOF) { log_error("Error closing file %s, errno = %d", dated_log->filename, errno); }