Skip to content

Commit

Permalink
Fix compiler warning.
Browse files Browse the repository at this point in the history
NULL is NOT 0 (zero).
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 60c4524 commit 7493333
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions src/lib/edit.c
Expand Up @@ -255,13 +255,36 @@ bool duration_to_utime(char *str, utime_t *value)
double val, total = 0.0;
char mod_str[20];
char num_str[50];

/*
* The "n" = mins and months appears before minutes so that m maps to months.
*/
static const char *mod[] = {"n", "seconds", "months", "minutes", "mins",
"hours", "days", "weeks", "quarters", "years", NULL};
static const int32_t mult[] = {60, 1, 60*60*24*30, 60, 60,
3600, 3600*24, 3600*24*7, 3600*24*91, 3600*24*365};
static const char *mod[] = {
"n",
"seconds",
"months",
"minutes",
"mins",
"hours",
"days",
"weeks",
"quarters",
"years",
(char *)NULL
};
static const int32_t mult[] = {
60,
1,
3600 * 24 * 30,
60,
60,
3600,
3600 * 24,
3600 * 24 * 7,
3600 * 24 * 91,
3600 * 24 * 365,
0
};

while (*str) {
if (!get_modifier(str, num_str, sizeof(num_str), mod_str, sizeof(mod_str))) {
Expand Down

0 comments on commit 7493333

Please sign in to comment.