summaryrefslogtreecommitdiffstats
path: root/m_struct.c
diff options
context:
space:
mode:
authorrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-09 06:50:53 +0000
committerrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-09 06:50:53 +0000
commit452c2c565205cb5a88cdf1570b689d7695a12b6d (patch)
treed13d88683a05aefbbd9a66f8d05fc5ca53ebf4e4 /m_struct.c
parentd1ba6a710eaaab84077cd19150ce8955a0d5cf2b (diff)
downloadmpv-452c2c565205cb5a88cdf1570b689d7695a12b6d.tar.bz2
mpv-452c2c565205cb5a88cdf1570b689d7695a12b6d.tar.xz
correct const usage in the option handling code so that tables can be
declared const and moved from .data to .text/rodata sections. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24994 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'm_struct.c')
-rw-r--r--m_struct.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/m_struct.c b/m_struct.c
index 347ba11fc2..9ffd356d31 100644
--- a/m_struct.c
+++ b/m_struct.c
@@ -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 @@ m_struct_get_field(m_struct_t* st,const char* f) {
}
void*
-m_struct_alloc(m_struct_t* st) {
+m_struct_alloc(const m_struct_t* st) {
int i;
void* r;
@@ -51,8 +51,8 @@ m_struct_alloc(m_struct_t* st) {
}
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 @@ m_struct_set(m_struct_t* st, void* obj, char* field, char* param) {
}
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 @@ m_struct_reset(m_struct_t* st, void* obj, const char* field) {
/// 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 @@ m_struct_free(m_struct_t* st, void* obj) {
}
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;