[FFmpeg-devel] [PATCH 2/6] Implement IOCTL_ERROR macro and use it.

Michael Niedermayer michaelni
Mon Apr 26 00:26:02 CEST 2010


On Mon, Apr 26, 2010 at 12:14:49AM +0200, Luca Abeni wrote:
> On Sun, 2010-04-25 at 20:01 +0200, Stefano Sabatini wrote:
> > On date Sunday 2010-04-25 10:52:41 +0200, Luca Abeni encoded:
> > > Hi,
> > > 
> > > On Sat, 2010-04-24 at 20:53 +0200, Stefano Sabatini wrote:
> > > [...] 
> > > > +#define IOCTL_ERROR(ctx__, ioctl__) av_log(ctx__, AV_LOG_ERROR, "ioctl(" #ioctl__ "): %s\n", strerror(errno))
> > > > +
> > > >  static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
> > > >  {
> > > >      struct v4l2_capability cap;
> > > > @@ -177,8 +179,7 @@ static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
> > > >          return AVERROR(errno);
> > > >      }
> > > >      if (res < 0) {
> > > > -        av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
> > > > -                 strerror(errno));
> > > > +        IOCTL_ERROR(ctx, VIDIOC_QUERYCAP);
> > > 
> > > I am not sure if this kind of changes really improve the readability.
> > 
> > I generalized the previous patch, now we have a log_errno() function
> > which is used whenever we need to print the string corresponding to an
> > errno.
> 
> If we really want to have a log_errno(), then I think it should not be
> private to v4l2.c (I expect that libav* contains some other code that
> want to print error messages followed by an errno description).
> 
> I suspect it could go to libavutil/log.c... If Michael approves it, then
> I am ok with the av_log() -> log_errno() contained in this patch.

you are trying to sidestep saying the patch is uhm by pushing it my
direction?


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100426/056b9681/attachment.pgp>



More information about the ffmpeg-devel mailing list