From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23322 invoked by alias); 27 Apr 2009 14:00:15 -0000 Received: (qmail 23234 invoked by alias); 27 Apr 2009 14:00:13 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_63,SPF_HELO_PASS X-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_63,SPF_HELO_PASS X-Spam-Check-By: sourceware.org X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bastion2.fedora.phx.redhat.com Subject: cluster: master - logthread: add const around and avoid shadowing To: cluster-cvs-relay@redhat.com X-Project: Cluster Project X-Git-Module: cluster.git X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 4e0c82519f2a0e7435b2592098336ffe35e7c935 X-Git-Newrev: 283b629de47f2a42dc91d33fb9c9e7bdc2d3603d From: "Fabio M. Di Nitto" Message-Id: <20090427135946.398731202FF@lists.fedorahosted.org> Date: Mon, 27 Apr 2009 14:00:00 -0000 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00121.txt.bz2 Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=283b629de47f2a42dc91d33fb9c9e7bdc2d3603d Commit: 283b629de47f2a42dc91d33fb9c9e7bdc2d3603d Parent: 4e0c82519f2a0e7435b2592098336ffe35e7c935 Author: Fabio M. Di Nitto AuthorDate: Mon Apr 27 15:56:06 2009 +0200 Committer: Fabio M. Di Nitto CommitterDate: Mon Apr 27 15:59:30 2009 +0200 logthread: add const around and avoid shadowing Signed-off-by: Fabio M. Di Nitto --- common/liblogthread/liblogthread.c | 22 +++++++++++----------- common/liblogthread/liblogthread.h | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/common/liblogthread/liblogthread.c b/common/liblogthread/liblogthread.c index 9254a37..ba96a2a 100644 --- a/common/liblogthread/liblogthread.c +++ b/common/liblogthread/liblogthread.c @@ -70,7 +70,7 @@ static void *thread_fn(void *arg) { char str[ENTRY_STR_LEN]; struct entry *e; - time_t time; + time_t logtime; int level, prev_dropped = 0; while (1) { @@ -89,18 +89,18 @@ static void *thread_fn(void *arg) memcpy(str, e->str, ENTRY_STR_LEN); level = e->level; - time = e->time; + logtime = e->time; prev_dropped = dropped; dropped = 0; pthread_mutex_unlock(&mutex); if (prev_dropped) { - write_dropped(level, &time, prev_dropped); + write_dropped(level, &logtime, prev_dropped); prev_dropped = 0; } - write_entry(level, &time, str); + write_entry(level, &logtime, str); } out: pthread_exit(NULL); @@ -129,7 +129,7 @@ static void _logt_print(int level, char *buf) pthread_mutex_unlock(&mutex); } -void logt_print(int level, char *fmt, ...) +void logt_print(int level, const char *fmt, ...) { va_list ap; char buf[ENTRY_STR_LEN]; @@ -154,8 +154,8 @@ void logt_print(int level, char *fmt, ...) _logt_print(level, buf); } -static void _conf(char *name, int mode, int syslog_facility, - int syslog_priority, int logfile_priority, char *logfile) +static void _conf(const char *name, int mode, int syslog_facility, + int syslog_priority, int logfile_priority, const char *logfile) { int fd; @@ -193,8 +193,8 @@ static void _conf(char *name, int mode, int syslog_facility, pthread_mutex_unlock(&mutex); } -void logt_conf(char *name, int mode, int syslog_facility, int syslog_priority, - int logfile_priority, char *logfile) +void logt_conf(const char *name, int mode, int syslog_facility, int syslog_priority, + int logfile_priority, const char *logfile) { if (!init) return; @@ -203,8 +203,8 @@ void logt_conf(char *name, int mode, int syslog_facility, int syslog_priority, logfile); } -int logt_init(char *name, int mode, int syslog_facility, int syslog_priority, - int logfile_priority, char *logfile) +int logt_init(const char *name, int mode, int syslog_facility, int syslog_priority, + int logfile_priority, const char *logfile) { int rv; diff --git a/common/liblogthread/liblogthread.h b/common/liblogthread/liblogthread.h index ace7abb..3c17395 100644 --- a/common/liblogthread/liblogthread.h +++ b/common/liblogthread/liblogthread.h @@ -7,13 +7,13 @@ #define LOG_MODE_OUTPUT_SYSLOG 2 #define LOG_MODE_OUTPUT_STDERR 4 -int logt_init(char *name, int mode, int syslog_facility, int syslog_priority, - int logfile_priority, char *logfile); -void logt_conf(char *name, int mode, int syslog_facility, int syslog_priority, - int logfile_priority, char *logfile); +int logt_init(const char *name, int mode, int syslog_facility, int syslog_priority, + int logfile_priority, const char *logfile); +void logt_conf(const char *name, int mode, int syslog_facility, int syslog_priority, + int logfile_priority, const char *logfile); void logt_exit(void); int logt_reinit(void); -void logt_print(int level, char *fmt, ...) +void logt_print(int level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));; #endif