From: Jason Ish Date: Wed, 31 May 2017 12:04:07 +0000 (-0600) Subject: profiling: fix const compiler warnings X-Git-Tag: suricata-4.0.0-beta1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb10bd7fca2c6cd4b92a8b091247d6fe7e3fc443;p=thirdparty%2Fsuricata.git profiling: fix const compiler warnings --- diff --git a/src/util-profiling-locks.c b/src/util-profiling-locks.c index 7719e6d5b7..efbe9720fb 100644 --- a/src/util-profiling-locks.c +++ b/src/util-profiling-locks.c @@ -38,7 +38,7 @@ __thread int record_locks = 0; int profiling_locks_enabled = 0; int profiling_locks_output_to_file = 0; char *profiling_locks_file_name = NULL; -char *profiling_locks_file_mode = "a"; +const char *profiling_locks_file_mode = "a"; typedef struct LockRecord_ { char *file; // hash @@ -106,7 +106,7 @@ int LockRecordInitHash() return 0; } -void LockRecordAdd(ProfilingLock *l) +static void LockRecordAdd(ProfilingLock *l) { LockRecord fn = { NULL, NULL, 0,0,0,0,0,0}, *ptr = &fn; fn.file = l->file; @@ -153,7 +153,7 @@ void SCProfilingAddPacketLocks(void *p) } } -void SCProfilingListLocks(void) +static void SCProfilingListLocks(void) { FILE *fp = NULL; @@ -180,7 +180,7 @@ void SCProfilingListLocks(void) while (b) { LockRecord *r = HashListTableGetListData(b); - char *lock; + const char *lock; switch (r->type) { case LOCK_MUTEX: lock = "mtx"; diff --git a/src/util-profiling.c b/src/util-profiling.c index d7ed401bea..871ab7a4ce 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -55,7 +55,7 @@ static FILE *packet_profile_csv_fp = NULL; extern int profiling_locks_enabled; extern int profiling_locks_output_to_file; extern char *profiling_locks_file_name; -extern char *profiling_locks_file_mode; +extern const char *profiling_locks_file_mode; typedef struct SCProfilePacketData_ { uint64_t min; @@ -255,8 +255,7 @@ SCProfilingInit(void) const char *filename = ConfNodeLookupChildValue(conf, "filename"); if (filename != NULL) { - char *log_dir; - log_dir = ConfigGetLogDirectory(); + const char *log_dir = ConfigGetLogDirectory(); profiling_locks_file_name = SCMalloc(PATH_MAX); if (unlikely(profiling_locks_file_name == NULL)) {