[CCR PATCH] Create memory space for CCR gas pressures (part 2) style

Dirk Hohndel dirk at hohndel.org
Thu Sep 4 11:08:17 PDT 2014


On Thu, Sep 04, 2014 at 07:31:42PM +0200, Willem Ferguson wrote:
> On 04/09/2014 16:58, Salvo Tomaselli wrote:
> >In data martedì 26 agosto 2014 10:39:14, Dirk Hohndel ha scritto:
> >>Both this and the previous patch are whitespace damaged.
> >>
> >>Can I please get ONE patch that uses tabs to indent?
> >It would be cool if you could provide astyle parameters or something similar
> >to use before applying patches, so that they are styled properly (not just the
> >tabs but everything else too.
> >
> 
> I normally go town the left hand of the code and delete-tab back EACH line
> until it is flush against the left margin. Then I tab this line of code in
> order to place it back in the correct horizontal position. Then I go down
> the right hand side of the code checking each line to see there is no space
> at the end of the line. White space is difficult to see, so I may perhaps
> indulge in an oversight here and there but I really try to do this
> consistently.

Umm. That's nuts :-)

Use emacs and do M-x whitespace-cleanup and 99% of the problems will be
fixed. And with the settings in the CodingStyle document most editors will
help you produce good looking and correctly indented code to begin with.

Which editor are you using by default?

> With respect to comments with code on the left of a line and a comment line
> in the right hand part, its more difficult, since I usually space the
> comments so that the right-hand comments on different lines are aligned in
> order to facilitate easy reading. So these middle-of-the line white space
> may comprise both tabs and spaces.

And I occasionally clean those up. :-)

> I have run code through the pearl script but it just gave me back what I fed
> into it. Maybe I do not know what to look for?? Unfortunately I do not have
> the original code of the second stage CCR patch any more (I am already one
> step further).
> 
> Here is the start of the pearl script output for my mast patch (Part 3 of
> the CCR code):
> 
> willem at dive:~/Desktop$ ./whitespace.pl clang.c
> --- clang.c.old    2014-09-04 19:21:35.931808600 +0200
> +++ clang.c    2014-09-04 19:26:34.057729072 +0200
> @@ -1,117 +0,0 @@
> -/* This function goes through the list of tank pressures, either
> SENSOR_PRESSURE(entry) or DILUENT_PRESSURE(entry),
> - * of structure plot_info for the dive profile where each item in the list
> corresponds to one point (node) of the
> - * profile. It finds values for which there are no tank pressures
> (pressure==0). For each missing item (node) of
> - * tank pressure it creates a pr_track_alloc structure that represents a
> segment on the dive profile and that
> - * contains tank pressures. There is a linked list of pr_track_alloc
> structures for each cylinder. These pr_track_alloc
> - * structures ultimately allow for filling the missing tank pressure values
> on the dive profile using the depth_pressure
> - * of the dive. To do this, it calculates the summed pressure-time value
> for the duration of the dive and stores these
> - * in the pr_track_alloc structures. If diluent_flag = 1, then
> DILUENT_PRESSURE(entry) is used instead of SENSOR_PRESSURE.
> - * This function is called by create_plot_info_new() in profile.c
> - */
> -void populate_pressure_information(struct dive *dive, struct divecomputer
> *dc, struct plot_info *pi, int diluent_flag)
> -{
> 
> Looks like there are 3 places of interest, but I have no idea where they may
> be.
> Any hints about grater white-space efficiency would be highly appreciated.

In its line-broken state it's almost unreadable...

/D


More information about the subsurface mailing list