[gst-devel] g_return_val_if_fail usage in dparams

Stefan Kost kost at imn.htwk-leipzig.de
Mon Jan 3 11:34:32 CET 2005

hi hi,

even though the current dparams will be replaced, the current implementation has
something I consider as a flaw.
No only incomming parameters are checked with g_return_val_if_fail(), also
during the method this used. The problem is that during unit test this causes
the test to fail, without that one can check for it.

The specific case is dparammanager.c::gst_dpman_get_dparam().
If name is nonsense a method that is invoked will return NULL and therefore the
method will abort with a CRITICAL instead of just returning NULL, so that the
callee could handle the problem.
Infact GError could be used to give the callee detail what has caused the error.

To avoid API changes, I would like to change those
  g_return_val_if_fail(dpwrap != NULL, NULL);
statements into
  if(!dpwrap) {
    GST_INFO("invalid dparam name");

Any objections? Steve?

      \|/            Stefan Kost
     <@ @>           private            business
+-oOO-(_)-OOo------------------------------------------------------ - - -  -   -
|       __  Address  Simildenstr. 5     HTWK Leipzig, Fb IMN, Postfach 301166
|      ///           04277 Leipzig      04251 Leipzig
| __  ///            Germany            Germany
| \\\///    Phone    +49341 2253538     +49341 30766101
|  \__/     EMail    st_kost_at_gmx.net kost_at_imn.htwk-leipzig.de
|           WWW      www.sonicpulse.de  www.imn.htwk-leipzig.de/~kost/about.html
===-=-=--=---=---------------------------------- - - -  -    -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kost.vcf
Type: text/x-vcard
Size: 345 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20050103/5ef18b26/attachment.vcf>

More information about the gstreamer-devel mailing list