From 01ac0b14bea486a626d8565dec8c8e546bb3d82f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 22 Oct 2008 08:37:59 -0700 Subject: Constify lock.c --- lock.c | 22 +++++++++++----------- lock.h | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lock.c b/lock.c index 3170458..9a4553a 100644 --- a/lock.c +++ b/lock.c @@ -31,14 +31,14 @@ in this Software without prior written authorization from The Open Group. #include -static char * +static const char * GetPath(void) { - char *path = (char *) getenv ("SM_SAVE_DIR"); + const char *path = getenv ("SM_SAVE_DIR"); if (!path) { - path = (char *) getenv ("HOME"); + path = getenv ("HOME"); if (!path) path = "."; } @@ -48,9 +48,9 @@ GetPath(void) Status -LockSession(char *session_name, Bool write_id) +LockSession(const char *session_name, Bool write_id) { - char *path; + const char *path; char lock_file[PATH_MAX]; char temp_lock_file[PATH_MAX]; Status status; @@ -98,9 +98,9 @@ LockSession(char *session_name, Bool write_id) void -UnlockSession(char *session_name) +UnlockSession(const char *session_name) { - char *path; + const char *path; char lock_file[PATH_MAX]; path = GetPath (); @@ -113,9 +113,9 @@ UnlockSession(char *session_name) char * -GetLockId(char *session_name) +GetLockId(const char *session_name) { - char *path; + const char *path; FILE *fp; char lock_file[PATH_MAX]; char buf[256]; @@ -142,7 +142,7 @@ GetLockId(char *session_name) Bool -CheckSessionLocked(char *session_name, Bool get_id, char **id_ret) +CheckSessionLocked(const char *session_name, Bool get_id, char **id_ret) { if (get_id) *id_ret = GetLockId (session_name); @@ -156,7 +156,7 @@ CheckSessionLocked(char *session_name, Bool get_id, char **id_ret) void -UnableToLockSession(char *session_name) +UnableToLockSession(const char *session_name) { /* * We should popup a dialog here giving error. diff --git a/lock.h b/lock.h index 19805ef..ca4eccf 100644 --- a/lock.h +++ b/lock.h @@ -30,10 +30,10 @@ in this Software without prior written authorization from The Open Group. #include -extern Status LockSession(char *session_name, Bool write_id); -extern void UnlockSession(char* session_name); -extern char * GetLockId(char *session_name); -extern Bool CheckSessionLocked(char *session_name, Bool get_id, char **id_ret); -extern void UnableToLockSession(char *session_name); +extern Status LockSession(const char *session_name, Bool write_id); +extern void UnlockSession(const char* session_name); +extern char * GetLockId(const char *session_name); +extern Bool CheckSessionLocked(const char *session_name, Bool get_id, char **id_ret); +extern void UnableToLockSession(const char *session_name); #endif -- cgit v1.2.3