Fixing warning about freediving

Dirk Hohndel dirk at hohndel.org
Thu Oct 22 00:26:11 PDT 2015


On Thu, Oct 22, 2015 at 12:26:17AM +0200, Guido Lerch wrote:
> let me know what and why you rewrote, otherwise I wont grow.

Sure thing.

Read your commit message and read mine:

> > > Subject: [PATCH] Fixing build warning about freediving
> > >
> > > This just fixes an issue with freediving not being with a switch
> > statement
> > > that was a little annoying.
> > >
> > > location: profice.c
> > > function: plot_string

Fixing build warning about freediving

This just fixes an annoying warning that freediving wasn't
covered in the switch statement.



I guess it's a matter of style - I like mine better as it is clear and
concise (I hope) :-)

> > > diff --git a/profile.c b/profile.c
> > > index 55cf629..4bfb5ff 100644
> > > --- a/profile.c
> > > +++ b/profile.c
> > > @@ -1173,6 +1173,9 @@ static void plot_string(struct plot_info *pi,
> > struct plot_data *entry, struct me
> > >               case AIR:
> > >                       /* nothing */
> > >                       break;
> > > +             case FREEDIVING:
> > > +                     /* nothing */
> > > +                     break;

So you duplicate the "do nothing case". I figured it's easier and clearer
to do this:

--- a/profile.c
+++ b/profile.c
@@ -1171,6 +1171,7 @@ static void plot_string(struct plot_info *pi, struct
plot_data *entry, struct me
                        put_format(b, translate("gettextFromC", "END:
%d%s\nEADD: %d%s\n"), end, depth_unit, eadd, depth_unit);
                        break;
                case AIR:
+               case FREEDIVING:
                        /* nothing */
                        break;
                }


Nothing major, just fine tuning :-)

/D


More information about the subsurface mailing list