treewide: mark things static and const

Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
This commit is contained in:
Barnabás Pőcze 2021-06-27 17:47:13 +02:00
parent 48dbb4da3c
commit f5d51162c4
54 changed files with 303 additions and 241 deletions

View file

@ -32,9 +32,7 @@ do { \
static void test_core_abi(void)
{
struct pw_core_methods m;
struct pw_core_events e;
struct {
static const struct {
uint32_t version;
int (*add_listener) (void *object,
struct spa_hook *listener,
@ -54,7 +52,7 @@ static void test_core_abi(void)
size_t user_data_size);
int (*destroy) (void *object, void *proxy);
} methods = { PW_VERSION_CORE_METHODS, };
struct {
static const struct {
uint32_t version;
void (*info) (void *object, const struct pw_core_info *info);
void (*done) (void *object, uint32_t id, int seq);
@ -66,6 +64,9 @@ static void test_core_abi(void)
void (*remove_mem) (void *object, uint32_t id);
} events = { PW_VERSION_CORE_EVENTS, };
struct pw_core_events e;
struct pw_core_methods m;
TEST_FUNC(m, methods, version);
TEST_FUNC(m, methods, add_listener);
TEST_FUNC(m, methods, hello);