diff options
author | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-29 16:22:33 +0300 |
---|---|---|
committer | Uoti Urpala <uau@symbol.nonexistent.invalid> | 2008-04-29 16:22:33 +0300 |
commit | 4237cb821b9eb5b28f1d14963563077e55225396 (patch) | |
tree | ed4e563469c0c87029f7244309635ab7c5dd47b1 | |
parent | d3113662b040cab1ba8cb44dc90db206f5ec34ca (diff) | |
download | mpv-4237cb821b9eb5b28f1d14963563077e55225396.tar.bz2 mpv-4237cb821b9eb5b28f1d14963563077e55225396.tar.xz |
Move allocation/free of x11 struct to x11_common.c
Allocate the struct in the init function and free in uninit.
-rw-r--r-- | libvo/x11_common.c | 6 | ||||
-rw-r--r-- | libvo/x11_common.h | 2 | ||||
-rw-r--r-- | mplayer.c | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 76ccad6e35..85ed754958 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -9,6 +9,7 @@ #include "mp_msg.h" #include "mp_fifo.h" #include "x11_common.h" +#include "talloc.h" #ifdef X11_FULLSCREEN @@ -531,6 +532,7 @@ void vo_uninit(struct vo_x11_state *x11) XCloseDisplay(x11->display); x11->depthonscreen = 0; x11->display = NULL; + talloc_free(x11); } #include "osdep/keycodes.h" @@ -2536,8 +2538,9 @@ void xv_setup_colorkeyhandling(struct vo *vo, const char *ck_method_str, #endif -void vo_x11_init_state(struct vo_x11_state *s) +struct vo_x11_state *vo_x11_init_state(void) { + struct vo_x11_state *s = talloc_ptrtype(NULL, s); *s = (struct vo_x11_state){ .xv_ck_info = { CK_METHOD_MANUALFILL, CK_SRC_CUR }, .olddecor = MWM_DECOR_ALL, @@ -2545,4 +2548,5 @@ void vo_x11_init_state(struct vo_x11_state *s) MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE, .old_gravity = NorthWestGravity, }; + return s; } diff --git a/libvo/x11_common.h b/libvo/x11_common.h index cbf374f86c..eef178d680 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -86,7 +86,7 @@ extern Window mRootWin; extern int mScreen; extern int mLocalDisplay; -void vo_x11_init_state(struct vo_x11_state *s); +struct vo_x11_state *vo_x11_init_state(void); int vo_init(struct vo *vo); void vo_uninit(struct vo_x11_state *x11); extern void vo_x11_decoration(struct vo *vo, int d ); @@ -2575,8 +2575,7 @@ int gui_no_filename=0; mp_msg_init(); #ifdef HAVE_X11 - mpctx->x11_state = talloc_ptrtype(NULL, mpctx->x11_state); - vo_x11_init_state(mpctx->x11_state); + mpctx->x11_state = vo_x11_init_state(); #endif struct MPOpts *opts = &mpctx->opts; set_default_mplayer_options(opts); |