summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-02 17:03:13 +0200
committerwm4 <wm4@nowhere>2013-08-02 17:03:13 +0200
commitf8589c98891b11eea249c998b1dc2fac50c99b46 (patch)
tree31c556e5f1b645828febbc5e0db989f77baec291
parentbc1d61cf4296ab41564adb896e454e48c292e451 (diff)
downloadmpv-f8589c98891b11eea249c998b1dc2fac50c99b46.tar.bz2
mpv-f8589c98891b11eea249c998b1dc2fac50c99b46.tar.xz
Remove m_struct
Not needed anymore.
-rw-r--r--Makefile1
-rw-r--r--core/command.c1
-rw-r--r--core/m_option.c2
-rw-r--r--core/m_option.h1
-rw-r--r--core/m_struct.c91
-rw-r--r--core/m_struct.h112
6 files changed, 0 insertions, 208 deletions
diff --git a/Makefile b/Makefile
index 12c078f77f..eaa6449415 100644
--- a/Makefile
+++ b/Makefile
@@ -172,7 +172,6 @@ SOURCES = talloc.c \
core/m_config.c \
core/m_option.c \
core/m_property.c \
- core/m_struct.c \
core/mp_common.c \
core/mp_msg.c \
core/mp_ring.c \
diff --git a/core/command.c b/core/command.c
index 17b01686f2..ba0fc2aede 100644
--- a/core/command.c
+++ b/core/command.c
@@ -64,7 +64,6 @@
#ifdef CONFIG_DVDREAD
#include "stream/stream_dvd.h"
#endif
-#include "core/m_struct.h"
#include "screenshot.h"
#include "core/mp_core.h"
diff --git a/core/m_option.c b/core/m_option.c
index 33da609fdd..343768a23d 100644
--- a/core/m_option.c
+++ b/core/m_option.c
@@ -1776,8 +1776,6 @@ const m_option_type_t m_option_type_rel_time = {
//// Objects (i.e. filters, etc) settings
-#include "core/m_struct.h"
-
#undef VAL
#define VAL(x) (*(m_obj_settings_t **)(x))
diff --git a/core/m_option.h b/core/m_option.h
index 973da4daaa..b237c4b243 100644
--- a/core/m_option.h
+++ b/core/m_option.h
@@ -31,7 +31,6 @@
typedef struct m_option_type m_option_type_t;
typedef struct m_option m_option_t;
-struct m_struct_st;
struct m_config;
///////////////////////////// Options types declarations ////////////////////
diff --git a/core/m_struct.c b/core/m_struct.c
deleted file mode 100644
index 2bf5f36485..0000000000
--- a/core/m_struct.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/// \file
-/// \ingroup OptionsStruct
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "core/m_option.h"
-#include "core/m_struct.h"
-#include "core/mp_msg.h"
-
-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++) {
- if(strcasecmp(st->fields[i].name,f) == 0)
- return &st->fields[i];
- }
- return NULL;
-}
-
-void*
-m_struct_alloc(const m_struct_t* st) {
- int i;
- void* r;
-
- if(!st->defaults) {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Struct %s needs defaults\n",st->name);
- return NULL;
- }
-
- r = calloc(1,st->size);
- memcpy(r,st->defaults,st->size);
-
- for(i = 0 ; st->fields[i].name ; i++) {
- if(st->fields[i].type->flags & M_OPT_TYPE_DYNAMIC)
- memset(M_ST_MB_P(r,st->fields[i].p),0,st->fields[i].type->size);
- m_option_copy(&st->fields[i],M_ST_MB_P(r,st->fields[i].p),M_ST_MB_P(st->defaults,st->fields[i].p));
- }
- return r;
-}
-
-int m_struct_set(const m_struct_t *st, void *obj, const char *field,
- struct bstr 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",
- st->name,field);
- return 0;
- }
-
- if(f->type->parse(f, bstr0(field), param, M_ST_MB_P(obj,f->p)) < 0) {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,"Struct %s, field %s parsing error: %.*s\n",
- st->name, field, BSTR_P(param));
- return 0;
- }
-
- return 1;
-}
-
-/// Free an allocated struct
-void
-m_struct_free(const m_struct_t* st, void* obj) {
- int i;
-
- for(i = 0 ; st->fields[i].name ; i++)
- m_option_free(&st->fields[i],M_ST_MB_P(obj,st->fields[i].p));
- free(obj);
-}
diff --git a/core/m_struct.h b/core/m_struct.h
deleted file mode 100644
index b0b0afe23d..0000000000
--- a/core/m_struct.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_M_STRUCT_H
-#define MPLAYER_M_STRUCT_H
-
-#include <stddef.h>
-#include <inttypes.h>
-
-#include "core/bstr.h"
-
-/// \defgroup OptionsStruct Options struct
-/// \ingroup Options
-/// An API to manipulate structs using m_option.
-///@{
-
-/// \file m_struct.h
-
-struct m_option;
-
-/// Struct definition
-typedef struct m_struct_st {
- /// For error messages and debugging
- const char* name;
- /// size of the whole struct
- unsigned int size;
- /// Pointer to a struct filled with the default settings
- const void* defaults;
- /// Field list.
- /** 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).
- */
- const struct m_option* fields;
-} m_struct_t;
-
-
-/// Get the offset of a struct field.
-/** \param struct_type Struct type.
- * \param member Name of the field.
- * \return The offset of the field in bytes.
- */
-#define M_ST_OFF (void *)(uintptr_t)offsetof
-
-/// Get a pointer to a struct field.
-/** \param struct_p Pointer to the struct.
- * \param struct_offset Offset of the field in the struct.
- * \return Pointer to the struct field.
- */
-#define M_ST_MB_P(struct_p, struct_offset) \
- ((void *)((char *)(struct_p) + (uintptr_t)(struct_offset)))
-
-/// Access a struct field at a given offset.
-/** \param member_type Type of the field.
- * \param struct_p Pointer to the struct.
- * \param struct_offset Offset of the field in the struct.
- * \return The struct field at the given offset.
- */
-#define M_ST_MB(member_type, struct_p, struct_offset) \
- (*(member_type*) M_ST_MB_P ((struct_p), (struct_offset)))
-
-
-
-/// Allocate the struct and set it to the defaults.
-/** \param st Struct definition.
- * \return The newly allocated object set to default.
- */
-void*
-m_struct_alloc(const m_struct_t* st);
-
-/// Set a field of the struct.
-/** \param st Struct definition.
- * \param obj Pointer to the struct to set.
- * \param field Name of the field to set.
- * \param param New value of the field.
- * \return 0 on error, 1 on success.
- */
-int m_struct_set(const m_struct_t *st, void *obj, const char *field,
- struct bstr param);
-
-/// Free an allocated struct.
-/** \param st Struct definition.
- * \param obj Pointer to the struct to copy.
- */
-void
-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.
- */
-const struct m_option*
-m_struct_get_field(const m_struct_t* st,const char* f);
-
-///@}
-
-#endif /* MPLAYER_M_STRUCT_H */