]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Clean up SCLocalTime() usage
authorKen Steele <ken@tilera.com>
Tue, 27 Aug 2013 21:16:59 +0000 (17:16 -0400)
committerVictor Julien <victor@inliniac.net>
Mon, 2 Sep 2013 13:03:30 +0000 (15:03 +0200)
Remove cast of return type from SCLocalTime() as it is not needed.
Replace last use of localtime_r() with SCLocalTime().

src/counters.c
src/detect-engine-analyzer.c
src/log-httplog.c
src/log-pcap.c
src/util-profiling-rules.c

index a6d1b10072e893faff458435337d80264bca052b..d023594935850f457607565e265bb421d71718db 100644 (file)
@@ -1049,7 +1049,7 @@ static int SCPerfOutputCounterFileIface()
 
     gettimeofday(&tval, NULL);
     struct tm local_tm;
-    tms = (struct tm *)SCLocalTime(tval.tv_sec, &local_tm);
+    tms = SCLocalTime(tval.tv_sec, &local_tm);
 
     /* Calculate the Engine uptime */
     int up_time = (int)difftime(tval.tv_sec, sc_start_time);
index 2c0d2ddf8862f68fcebd2d7bf440a8ddcc584496..052b5bab8ed7b035b89244d33ce4cf7eca1b72a7 100644 (file)
@@ -210,7 +210,7 @@ int SetupFPAnalyzer(void)
     struct tm *tms;
     gettimeofday(&tval, NULL);
     struct tm local_tm;
-    tms = (struct tm *)SCLocalTime(tval.tv_sec, &local_tm);
+    tms = SCLocalTime(tval.tv_sec, &local_tm);
     fprintf(fp_engine_analysis_FD, "----------------------------------------------"
             "---------------------\n");
     fprintf(fp_engine_analysis_FD, "Date: %" PRId32 "/%" PRId32 "/%04d -- "
@@ -257,7 +257,7 @@ int SetupRuleAnalyzer(void)
             struct tm *tms;
             gettimeofday(&tval, NULL);
             struct tm local_tm;
-            tms = (struct tm *)localtime_r(&tval.tv_sec, &local_tm);
+            tms = SCLocalTime(tval.tv_sec, &local_tm);
             fprintf(rule_engine_analysis_FD, "----------------------------------------------"
                     "---------------------\n");
             fprintf(rule_engine_analysis_FD, "Date: %" PRId32 "/%" PRId32 "/%04d -- "
index 57176a34263520a887142a2c192d92bb70112314..76740893352d38e18f86205e55048893a07b5f0e 100644 (file)
@@ -156,7 +156,7 @@ static void LogHttpLogCustom(LogHttpLogThread *aft, htp_tx_t *tx, const struct t
 
     time_t time = ts->tv_sec;
     struct tm local_tm;
-    struct tm *timestamp = (struct tm *)SCLocalTime(time, &local_tm);
+    struct tm *timestamp = SCLocalTime(time, &local_tm);
 
     for (i = 0; i < httplog_ctx->cf_n; i++) {
         switch (httplog_ctx->cf_nodes[i]->type){
index 431bd2c131e51111fcb11022b701e3b25f96b562..652379e04c7ccb5af7158158ee87aa01aca0ab36 100644 (file)
@@ -272,7 +272,7 @@ TmEcode PcapLog (ThreadVars *t, Packet *p, void *data, PacketQueue *pq,
 
     if (pl->mode == LOGMODE_SGUIL) {
         struct tm local_tm;
-        struct tm *tms = (struct tm *)SCLocalTime(p->ts.tv_sec, &local_tm);
+        struct tm *tms = SCLocalTime(p->ts.tv_sec, &local_tm);
         if (tms->tm_mday != pl->prev_day) {
             rotate = 1;
             pl->prev_day = tms->tm_mday;
@@ -342,7 +342,7 @@ TmEcode PcapLogDataInit(ThreadVars *t, void *initdata, void **data)
     memset(&ts, 0x00, sizeof(struct timeval));
     TimeGet(&ts);
     struct tm local_tm;
-    struct tm *tms = (struct tm *)SCLocalTime(ts.tv_sec, &local_tm);
+    struct tm *tms = SCLocalTime(ts.tv_sec, &local_tm);
     pl->prev_day = tms->tm_mday;
 
     *data = (void *)pl;
@@ -612,7 +612,7 @@ int PcapLogOpenFileCtx(PcapLogData *pl)
 
     if (pl->mode == LOGMODE_SGUIL) {
         struct tm local_tm;
-        struct tm *tms = (struct tm *)SCLocalTime(ts.tv_sec, &local_tm);
+        struct tm *tms = SCLocalTime(ts.tv_sec, &local_tm);
 
         char dirname[32], dirfull[PATH_MAX] = "";
 
index 97cda892b232043a56cd09e71980b45231966658..570805f22abde1432e95d7d90140e1bfb688f2d2 100644 (file)
@@ -359,7 +359,7 @@ SCProfilingRuleDump(SCProfileDetectCtx *rules_ctx)
 
     gettimeofday(&tval, NULL);
     struct tm local_tm;
-    tms = (struct tm *)SCLocalTime(tval.tv_sec, &local_tm);
+    tms = SCLocalTime(tval.tv_sec, &local_tm);
 
     fprintf(fp, "  ----------------------------------------------"
             "----------------------------\n");