From 974a79f0fdd6069d2e24e424a3954e2279742e85 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 17 Feb 2016 20:06:04 -0500 Subject: Fix an uninitialized value warning. --- eval.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eval.c b/eval.c index 6f03249..b5bef33 100644 --- a/eval.c +++ b/eval.c @@ -11,6 +11,7 @@ #include "bfs.h" #include "bftw.h" +#include #include #include #include @@ -118,7 +119,7 @@ bool eval_acmtime(const struct expr *expr, struct eval_state *state) { return false; } - const struct timespec *time; + const struct timespec *time = NULL; switch (expr->timefield) { case ATIME: time = &statbuf->st_atim; @@ -130,6 +131,7 @@ bool eval_acmtime(const struct expr *expr, struct eval_state *state) { time = &statbuf->st_mtim; break; } + assert(time); time_t diff = timespec_diff(&expr->reftime, time); switch (expr->timeunit) { @@ -153,7 +155,7 @@ bool eval_acnewer(const struct expr *expr, struct eval_state *state) { return false; } - const struct timespec *time; + const struct timespec *time = NULL; switch (expr->timefield) { case ATIME: time = &statbuf->st_atim; @@ -165,6 +167,7 @@ bool eval_acnewer(const struct expr *expr, struct eval_state *state) { time = &statbuf->st_mtim; break; } + assert(time); return time->tv_sec > expr->reftime.tv_sec || (time->tv_sec == expr->reftime.tv_sec && time->tv_nsec > expr->reftime.tv_nsec); -- cgit v1.2.3