mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -05:00
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:
parent
48dbb4da3c
commit
f5d51162c4
54 changed files with 303 additions and 241 deletions
|
|
@ -33,8 +33,7 @@ do { \
|
|||
|
||||
static void test_abi(void)
|
||||
{
|
||||
struct pw_impl_client_events ev;
|
||||
struct {
|
||||
static const struct {
|
||||
uint32_t version;
|
||||
void (*destroy) (void *data);
|
||||
void (*free) (void *data);
|
||||
|
|
@ -45,6 +44,8 @@ static void test_abi(void)
|
|||
void (*busy_changed) (void *data, bool busy);
|
||||
} test = { PW_VERSION_IMPL_CLIENT_EVENTS, NULL };
|
||||
|
||||
struct pw_impl_client_events ev;
|
||||
|
||||
TEST_FUNC(ev, test, destroy);
|
||||
TEST_FUNC(ev, test, free);
|
||||
TEST_FUNC(ev, test, initialized);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -36,13 +36,12 @@ do { \
|
|||
|
||||
static void test_abi(void)
|
||||
{
|
||||
struct pw_stream_events ev;
|
||||
struct {
|
||||
static const struct {
|
||||
uint32_t version;
|
||||
void (*destroy) (void *data);
|
||||
void (*state_changed) (void *data, enum pw_stream_state old,
|
||||
enum pw_stream_state state, const char *error);
|
||||
void (*control_info) (void *data, uint32_t id, const struct pw_stream_control *control);
|
||||
void (*control_info) (void *data, uint32_t id, const struct pw_stream_control *control);
|
||||
void (*io_changed) (void *data, uint32_t id, void *area, uint32_t size);
|
||||
void (*param_changed) (void *data, uint32_t id, const struct spa_pod *param);
|
||||
void (*add_buffer) (void *data, struct pw_buffer *buffer);
|
||||
|
|
@ -51,6 +50,8 @@ static void test_abi(void)
|
|||
void (*drained) (void *data);
|
||||
} test = { PW_VERSION_STREAM_EVENTS, NULL };
|
||||
|
||||
struct pw_stream_events ev;
|
||||
|
||||
TEST_FUNC(ev, test, destroy);
|
||||
TEST_FUNC(ev, test, state_changed);
|
||||
TEST_FUNC(ev, test, control_info);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue