Skip to content

garray: Add assertions to help static analysis

Philip Withnall requested to merge pwithnall/glib:coverity-array-fixes into main

In both these cases, the static analyser (Coverity) was worrying that the array data/pdata wasn’t allocated before an element was written to. That was a false positive: all the necessary conditions are met in both cases for g_{ptr_,}array_maybe_expand() to always allocate the array.

But it makes things a bit easier for the analyser if we add an assertion to double-check that.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Coverity CID: #1474426, #1489512

Merge request reports