cond_set_path(): minor, improve debug, 'new' -> 'next'

- Avoid using reserved C++ keyword 'new'
 - Rename new -> next
 - Rename old -> prev
 - Add debug for value being set to cond path

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2021-04-15 08:44:03 +02:00
parent 3d1b95aa7a
commit f958aa504e
+6 -6
View File
@@ -127,12 +127,12 @@ static int cond_checkpath(const char *path)
return 0;
}
int cond_set_path(const char *path, enum cond_state new)
int cond_set_path(const char *path, enum cond_state next)
{
enum cond_state old;
enum cond_state prev;
unsigned int rgen;
_d("%s", path);
_d("%s <= %d", path, next);
rgen = cond_get_gen(_PATH_RECONF);
if (!rgen) {
@@ -140,9 +140,9 @@ int cond_set_path(const char *path, enum cond_state new)
return -1;
}
old = cond_get_path(path);
prev = cond_get_path(path);
switch (new) {
switch (next) {
case COND_ON:
if (cond_checkpath(path))
return 0;
@@ -159,7 +159,7 @@ int cond_set_path(const char *path, enum cond_state new)
return 0;
}
return new != old;
return next != prev;
}
/* Should only be used by cond_set*(), cond_clear(), and usr plugin! */