[vlc-devel] commit: ncurses: redirect standard error to /dev/null ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Feb 10 18:39:52 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Feb 10 19:38:41 2009 +0200| [3af97bb6d9d638a783c27f687f72b989d5b7455c] | committer: Rémi Denis-Courmont 

ncurses: redirect standard error to /dev/null

Changing the verbosity at that point is not thread-safe (and trying to
restore the value at ext is somwehat logically flawed). Luckily all the
standard <stdio.h> functions are thread-safe.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3af97bb6d9d638a783c27f687f72b989d5b7455c
---

 modules/gui/ncurses.c |   15 ++-------------
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index aadf1fb..e5099b3 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -227,8 +227,6 @@ struct intf_sys_t
     struct pl_item_t    **pp_plist;
     int             i_plist_entries;
     bool      b_need_update;              /* for playlist view         */
-
-    int             i_verbose;                  /* stores verbosity level    */
 };
 
 static void DrawBox( WINDOW *win, int y, int x, int h, int w, const char *title, bool b_color );
@@ -291,12 +289,8 @@ static int Open( vlc_object_t *p_this )
     /* exported function */
     p_intf->pf_run = Run;
 
-    /* Remember verbosity level */
-    var_Get( p_intf->p_libvlc, "verbose", &val );
-    p_sys->i_verbose = val.i_int;
-    /* Set quiet mode */
-    val.i_int = -1;
-    var_Set( p_intf->p_libvlc, "verbose", val );
+    /* Stop printing errors to the console */
+    freopen( "/dev/null", "wb", stderr );
 
     /* Set defaul playlist view */
     p_sys->i_current_view = VIEW_CATEGORY;
@@ -365,11 +359,6 @@ static void Close( vlc_object_t *p_this )
 
 // FIXME    msg_Unsubscribe( p_intf, p_sys->p_sub );
 
-    /* Restores initial verbose setting */
-    vlc_value_t val;
-    val.i_int = p_sys->i_verbose;
-    var_Set( p_intf->p_libvlc, "verbose", val );
-
     /* Destroy structure */
     free( p_sys );
 }




More information about the vlc-devel mailing list