QHash: fix -Werror=maybe-uninitialized (GCC 11.2)

The compiler doesn't understand understand that the only way ok can be
true is for qstrntoll() to have been executed.

  qhash.cpp:158:9: error: ‘seed’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    158 |         if (seed) {
        |         ^~

Help poor GCC by initializing the variable unconditionally.

Amends cc5cc3225d.

Change-Id: Ic8387e0add2291d994f7f4d96c4bc614b2a8aa99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-03-16 20:59:39 +01:00 committed by Thiago Macieira
parent d10b910e39
commit 021134195e
1 changed files with 1 additions and 1 deletions

View File

@ -149,7 +149,7 @@ private:
const char *seedstr = getenv("QT_HASH_SEED");
const char *endptr = nullptr;
bool ok = false;
int seed;
int seed = 0;
if (seedstr)
seed = qstrntoll(seedstr, strlen(seedstr), &endptr, 10, &ok);
if (ok && endptr != seedstr + strlen(seedstr))