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

@ -408,12 +408,7 @@ static int save_stream(struct stream *str)
static void update_stream(struct stream *str)
{
struct impl *impl = str->impl;
uint32_t i;
const char *p;
char *key;
struct sm_object *obj = &str->obj->obj;
const char *keys[] = {
static const char * const keys[] = {
PW_KEY_MEDIA_ROLE,
PW_KEY_APP_ID,
PW_KEY_APP_NAME,
@ -421,6 +416,12 @@ static void update_stream(struct stream *str)
PW_KEY_NODE_NAME,
};
struct impl *impl = str->impl;
uint32_t i;
const char *p;
char *key;
struct sm_object *obj = &str->obj->obj;
key = NULL;
for (i = 0; i < SPA_N_ELEMENTS(keys); i++) {
if ((p = pw_properties_get(obj->props, keys[i]))) {