public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: master - logthread: add const around and avoid shadowing
@ 2009-04-27 14:00 Fabio M. Di Nitto
0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-04-27 14:00 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=283b629de47f2a42dc91d33fb9c9e7bdc2d3603d
Commit: 283b629de47f2a42dc91d33fb9c9e7bdc2d3603d
Parent: 4e0c82519f2a0e7435b2592098336ffe35e7c935
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate: Mon Apr 27 15:56:06 2009 +0200
Committer: Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Mon Apr 27 15:59:30 2009 +0200
logthread: add const around and avoid shadowing
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-27 14:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-27 14:00 cluster: master - logthread: add const around and avoid shadowing Fabio M. Di Nitto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).