BUILD: server: check->desc always exists

Clang reports this warning :

  src/server.c:872:14: warning: address of array 'check->desc' will
  always evaluate to 'true' [-Wpointer-bool-conversion]

Indeed, check->desc used to be a pointer to a dynamically allocated area
a long time ago and is now an array. Let's remove the useless test.
This commit is contained in:
Willy Tarreau 2017-11-20 21:33:21 +01:00
parent 1f09467114
commit 358847f026

View File

@ -869,8 +869,7 @@ void srv_set_stopped(struct server *s, const char *reason, struct check *check)
strlcpy2(s->op_st_chg.reason, reason, sizeof(s->op_st_chg.reason));
}
else if (check) {
if (check->desc)
strlcpy2(s->op_st_chg.reason, check->desc, sizeof(s->op_st_chg.reason));
strlcpy2(s->op_st_chg.reason, check->desc, sizeof(s->op_st_chg.reason));
s->op_st_chg.code = check->code;
s->op_st_chg.status = check->status;
s->op_st_chg.duration = check->duration;
@ -908,8 +907,7 @@ void srv_set_running(struct server *s, const char *reason, struct check *check)
strlcpy2(s->op_st_chg.reason, reason, sizeof(s->op_st_chg.reason));
}
else if (check) {
if (check->desc)
strlcpy2(s->op_st_chg.reason, check->desc, sizeof(s->op_st_chg.reason));
strlcpy2(s->op_st_chg.reason, check->desc, sizeof(s->op_st_chg.reason));
s->op_st_chg.code = check->code;
s->op_st_chg.status = check->status;
s->op_st_chg.duration = check->duration;
@ -952,8 +950,7 @@ void srv_set_stopping(struct server *s, const char *reason, struct check *check)
strlcpy2(s->op_st_chg.reason, reason, sizeof(s->op_st_chg.reason));
}
else if (check) {
if (check->desc)
strlcpy2(s->op_st_chg.reason, check->desc, sizeof(s->op_st_chg.reason));
strlcpy2(s->op_st_chg.reason, check->desc, sizeof(s->op_st_chg.reason));
s->op_st_chg.code = check->code;
s->op_st_chg.status = check->status;
s->op_st_chg.duration = check->duration;