Files
xserver/glx
Enrico Weigelt, metux IT consult 9ee96639d7 glx: createcontext: silence analyzer warning and make code easier to understand
This warning is probably a false alarm, but it's trivial to fix.

| ../glx/createcontext.c: In function ‘__glXDisp_CreateContextAttribsARB’:
| ../glx/createcontext.c:172:24: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference]
|   172 |         switch (attribs[i * 2]) {
|       |                 ~~~~~~~^~~~~~~

The situation is too complex for the analyzer to handle:
(but also not immediately clear for the human reader)

* `attribs` is only NULL when req->numAttribs is 0
* in that case, the for loop is no-op, so `attribs` won't ever be deref'ed.

We can make it easier for both analyzer as well as human reader by just putting
the whole loop into an `if (req->numAttribs)` and assigning it inside there.
There shouldn't be any (practically measurable) extra cost.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:33:12 +02:00
..
2024-10-10 13:38:31 +00:00
2016-09-15 20:10:29 +01:00
2024-10-10 13:38:31 +00:00
2024-10-10 13:38:31 +00:00
2025-02-18 10:53:45 +00:00
2024-10-10 13:38:31 +00:00
2012-03-21 13:54:42 -07:00
2014-11-12 10:25:00 +10:00
2014-11-12 10:25:00 +10:00
2014-11-12 10:25:00 +10:00
2014-11-12 10:25:00 +10:00
2024-10-10 13:38:31 +00:00
2024-10-10 13:38:31 +00:00
2024-10-10 13:38:31 +00:00
2024-10-10 13:38:31 +00:00
2025-02-06 20:04:23 +00:00
2024-10-10 13:38:31 +00:00
2024-10-10 13:38:31 +00:00
2025-02-06 20:04:23 +00:00
2025-02-06 20:04:23 +00:00
2024-10-10 13:38:31 +00:00