conf: added the gcc "const" attribute to some functions
Add the "const" attribute to functions when their return value only depends on parameters. This allows gcc to eliminate some function calls.
This commit is contained in:
parent
f7cc5b2efd
commit
c76f71e8d6
13
src/conf.h
13
src/conf.h
|
@ -101,6 +101,7 @@ struct config_param {
|
|||
* A GQuark for GError instances, resulting from malformed
|
||||
* configuration.
|
||||
*/
|
||||
G_GNUC_CONST
|
||||
static inline GQuark
|
||||
config_quark(void)
|
||||
{
|
||||
|
@ -120,15 +121,18 @@ void config_read_file(const char *file);
|
|||
|
||||
/* don't free the returned value
|
||||
set _last_ to NULL to get first entry */
|
||||
G_GNUC_CONST
|
||||
struct config_param *
|
||||
config_get_next_param(const char *name, const struct config_param *last);
|
||||
|
||||
G_GNUC_CONST
|
||||
static inline struct config_param *
|
||||
config_get_param(const char *name)
|
||||
{
|
||||
return config_get_next_param(name, NULL);
|
||||
}
|
||||
|
||||
G_GNUC_CONST
|
||||
const char *
|
||||
config_get_string(const char *name, const char *default_value);
|
||||
|
||||
|
@ -137,21 +141,27 @@ config_get_string(const char *name, const char *default_value);
|
|||
* absolute path. If there is a tilde prefix, it is expanded. Aborts
|
||||
* MPD if the path is not a valid absolute path.
|
||||
*/
|
||||
G_GNUC_CONST
|
||||
const char *
|
||||
config_get_path(const char *name);
|
||||
|
||||
G_GNUC_CONST
|
||||
unsigned
|
||||
config_get_positive(const char *name, unsigned default_value);
|
||||
|
||||
G_GNUC_CONST
|
||||
struct block_param *
|
||||
config_get_block_param(const struct config_param *param, const char *name);
|
||||
|
||||
G_GNUC_CONST
|
||||
bool config_get_bool(const char *name, bool default_value);
|
||||
|
||||
G_GNUC_CONST
|
||||
const char *
|
||||
config_get_block_string(const struct config_param *param, const char *name,
|
||||
const char *default_value);
|
||||
|
||||
G_GNUC_CONST
|
||||
static inline char *
|
||||
config_dup_block_string(const struct config_param *param, const char *name,
|
||||
const char *default_value)
|
||||
|
@ -159,14 +169,17 @@ config_dup_block_string(const struct config_param *param, const char *name,
|
|||
return g_strdup(config_get_block_string(param, name, default_value));
|
||||
}
|
||||
|
||||
G_GNUC_CONST
|
||||
unsigned
|
||||
config_get_block_unsigned(const struct config_param *param, const char *name,
|
||||
unsigned default_value);
|
||||
|
||||
G_GNUC_CONST
|
||||
bool
|
||||
config_get_block_bool(const struct config_param *param, const char *name,
|
||||
bool default_value);
|
||||
|
||||
G_GNUC_CONST
|
||||
struct config_param *
|
||||
config_new_param(const char *value, int line);
|
||||
|
||||
|
|
Loading…
Reference in New Issue