]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: server: check->desc always exists
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Nov 2017 20:33:21 +0000 (21:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Nov 2017 20:33:21 +0000 (21:33 +0100)
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.

src/server.c

index 5e995f8a781a68f8513e8931fefdc7a23a7ed139..c712b889cb807830f305b5b92074968b25b292bc 100644 (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;