Commit graph

8 commits

Author SHA1 Message Date
Leandro Ribeiro
a4cefa69a2 shared: rename a few weston assert
Currently weston-test-assert.h has a better naming style than
weston-assert.h: more concise and standardized.

So let's copy the same style to weston-assert.h

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2025-09-15 19:13:04 -03:00
Pekka Paalanen
6773ffa758 libweston: fix bitshift in weston_idalloc_get_id()
Fixes the following UBSan error:

../../git/weston/libweston/id-number-allocator.c:140:16: runtime error:
left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-03-03 14:40:21 +02:00
Pekka Paalanen
ed51e9ae43 libweston: fix realloc in weston_idalloc
realloc() does not initialize the added memory, it needs to be zeroed
explicitly.

Not zeroing this memory had one severe consequence: if the new
lowest_free_bucket was 0xffffffff, weston_idalloc_get_id() would fail an
assertion.

Otherwise non-zero bits in the added memory would just cause id numbers
to be skipped unnecessarily, which does no harm.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/1000

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-03-03 13:51:25 +02:00
Pekka Paalanen
2733a95962 libweston: refactor update_lowest_free_bucket()
No functional change here other than asserting that next_num didn't wrap
around. This reorganization helps adding the code
needed to clear the memory added by xrealloc() in the next patch.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2025-03-03 13:51:05 +02:00
Marius Vlad
207fed2710 Revert "shared/helpers.h: Migrate helpers.h to libweston"
This is problematic as we don't have namespacing for these and some of
the macros can interfere with other defines.

This reverts commit 8634c7e349.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2025-01-17 10:18:26 +02:00
Marius Vlad
8634c7e349 shared/helpers.h: Migrate helpers.h to libweston
As weston_windowed_output_get_api needs ARRAY_LENGTH() move helpers to a
libweston/ so other users can re-use that instead of re-defining these
all over. Easier for other front-ends to make use of them.

With this change windowed-output-api.h also includes the helpers header.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-11-25 11:26:35 +00:00
Leandro Ribeiro
bcd76c372b libweston: fix indentation of a few files
Recently I accidentally created a few files using spaces instead of
tabs. This patch fixes that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-06-04 17:32:39 -03:00
Leandro Ribeiro
a84806a88e libweston: add unique id generator
This is preparation for the CM&HDR protocol implementation. It requires
us to give a unique id to each color-profile, so let's do that.

In this commit we introduce a generic id generator to libweston, and
its first user: the color-profile.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-02-13 14:08:38 -03:00