]> git.sesse.net Git - vlc/commitdiff
src/control/mediacontrol_util.c: revert rev. 19899, and document the
authorOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Thu, 3 May 2007 17:44:07 +0000 (17:44 +0000)
committerOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Thu, 3 May 2007 17:44:07 +0000 (17:44 +0000)
mediacontrol_exception_init function.

src/control/mediacontrol_util.c

index 9a20ba62a70652148cf25a73027a3496d53a0223..2c0d44bd5b480846ec649f9ae35052597e94be4a 100644 (file)
@@ -250,9 +250,28 @@ mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq* ps )
     free( ps );
 }
 
+/**
+ * Initialize a VLC exception.
+ *
+ * If given a NULL pointer, it will instanciate a new exception, which
+ * should be later freed by the caller. If given an existing
+ * exception, it will reset its code and message fields. In both
+ * cases, the exception pointer is returned.
+ *
+ * \param exception a pointer on a mediacontrol_Exception
+ * \return a pointer on a mediacontrol_Exception.
+ */
 mediacontrol_Exception*
 mediacontrol_exception_init( mediacontrol_Exception *exception )
 {
+    if( !exception )
+    {
+        exception = ( mediacontrol_Exception* )malloc( sizeof( mediacontrol_Exception ) );
+       if( !exception )
+        {
+            return NULL;
+        }
+    }
     exception->code = 0;
     exception->message = NULL;
     return exception;