Mercurial > mplayer.hg
diff m_struct.h @ 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 | 3f0d00abc073 |
children | 4129c8cfa742 |
line wrap: on
line diff
--- a/m_struct.h Fri Nov 09 03:49:32 2007 +0000 +++ b/m_struct.h Fri Nov 09 06:50:53 2007 +0000 @@ -22,7 +22,7 @@ /** The p field of the \ref m_option struct must contain the offset * of the member in the struct (use M_ST_OFF macro for this). */ - struct m_option* fields; + const struct m_option* fields; } m_struct_t; @@ -60,7 +60,7 @@ * \return The newly allocated object set to default. */ void* -m_struct_alloc(m_struct_t* st); +m_struct_alloc(const m_struct_t* st); /// Set a field of the struct. /** \param st Struct definition. @@ -70,7 +70,7 @@ * \return 0 on error, 1 on success. */ int -m_struct_set(m_struct_t* st, void* obj, char* field, char* param); +m_struct_set(const m_struct_t* st, void* obj, char* field, char* param); /// Reset a field (or all if field == NULL) to defaults. /** \param st Struct definition. @@ -78,7 +78,7 @@ * \param field Name of the field to reset, if NULL all fields are reseted. */ void -m_struct_reset(m_struct_t* st, void* obj, const char* field); +m_struct_reset(const m_struct_t* st, void* obj, const char* field); /// Create a copy of an existing struct. /** \param st Struct definition. @@ -86,22 +86,22 @@ * \return Newly allocated copy of obj. */ void* -m_struct_copy(m_struct_t* st, void* obj); +m_struct_copy(const m_struct_t* st, void* obj); /// Free an allocated struct. /** \param st Struct definition. * \param obj Pointer to the struct to copy. */ void -m_struct_free(m_struct_t* st, void* obj); +m_struct_free(const m_struct_t* st, void* obj); /// Get a field description. /** \param st Struct definition. * \param f Name of the field. * \return The \ref m_option struct describing the field or NULL if not found. */ -struct m_option* -m_struct_get_field(m_struct_t* st,const char* f); +const struct m_option* +m_struct_get_field(const m_struct_t* st,const char* f); ///@}