From: Willy Tarreau Date: Mon, 20 Nov 2017 20:33:21 +0000 (+0100) Subject: BUILD: server: check->desc always exists X-Git-Tag: v1.8.0~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=358847f026f7ca69e0c341326da3c34d45ec27db;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/server.c b/src/server.c index 5e995f8a78..c712b889cb 100644 --- a/src/server.c +++ b/src/server.c @@ -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;