Mercurial > mplayer.hg
diff m_struct.c @ 24966:cc170348a763
correct const usage in the option handling code so that tables can be
declared const and moved from .data to .text/rodata sections.
author | rfelker |
---|---|
date | Fri, 09 Nov 2007 06:50:53 +0000 |
parents | 49a433e2e78f |
children | 0f1b5b68af32 |
line wrap: on
line diff
--- a/m_struct.c Fri Nov 09 03:49:32 2007 +0000 +++ b/m_struct.c Fri Nov 09 06:50:53 2007 +0000 @@ -11,8 +11,8 @@ #include "m_struct.h" #include "mp_msg.h" -m_option_t* -m_struct_get_field(m_struct_t* st,const char* f) { +const m_option_t* +m_struct_get_field(const m_struct_t* st,const char* f) { int i; for(i = 0 ; st->fields[i].name ; i++) { @@ -23,7 +23,7 @@ } void* -m_struct_alloc(m_struct_t* st) { +m_struct_alloc(const m_struct_t* st) { int i; void* r; @@ -51,8 +51,8 @@ } int -m_struct_set(m_struct_t* st, void* obj, char* field, char* param) { - m_option_t* f = m_struct_get_field(st,field); +m_struct_set(const m_struct_t* st, void* obj, char* field, char* param) { + const m_option_t* f = m_struct_get_field(st,field); if(!f) { mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Struct %s doesn't have any %s field\n", @@ -70,8 +70,8 @@ } void -m_struct_reset(m_struct_t* st, void* obj, const char* field) { - m_option_t* f; +m_struct_reset(const m_struct_t* st, void* obj, const char* field) { + const m_option_t* f; if(!field) { // Reset all options int i; @@ -92,7 +92,7 @@ /// Free an allocated struct void -m_struct_free(m_struct_t* st, void* obj) { +m_struct_free(const m_struct_t* st, void* obj) { int i; for(i = 0 ; st->fields[i].name ; i++) @@ -101,7 +101,7 @@ } void* -m_struct_copy(m_struct_t* st, void* obj) { +m_struct_copy(const m_struct_t* st, void* obj) { void* r = malloc(st->size); int i;