[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] gpsd style change?
From: |
Gary E. Miller |
Subject: |
[gpsd-dev] gpsd style change? |
Date: |
Tue, 10 Feb 2015 19:56:11 -0800 |
Yo All!
A lot of changes like this in recent git commit:
5b4af8cc002773058ad744f9c2f9975284b09224
diff --git a/monitor_ubx.c b/monitor_ubx.c
index 8b4101e..f73a06b 100644
--- a/monitor_ubx.c
+++ b/monitor_ubx.c
@@ -260,13 +260,13 @@ static void ubx_update(void)
if (pps_thread_lastpps(&session, &drift) > 0) {
/* NOTE: can not use double here due to precision requirements */
struct timespec timedelta;
- char buf2[22];
TS_SUB( &timedelta, &drift.clock, &drift.real);
if ( 86400 < (long)labs(timedelta.tv_sec) ) {
/* more than one day off, overflow */
/* need a bigger field to show it */
(void)mvwprintw(ppswin, 1, 13, "> 1 day");
} else {
+ char buf2[22];
(void)timespec_str( &timedelta, buf2, sizeof(buf2) );
(void)mvwprintw(ppswin, 1, 13, "%s", buf2);
}
This is actually my preferred style of coding: to keep local variables
as local as possible.
But, when I have done this in the past, following commits have hoisted
the variable declarations to the top of the function.
Is this now an official style change? I would prefer it that way. If
so can it be made official somewhere so things don't move back and
forth.
Or, bigger picture, maybe a real style guide?
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
address@hidden Tel:+1(541)382-8588
- [gpsd-dev] gpsd style change?,
Gary E. Miller <=
- Re: [gpsd-dev] gpsd style change?, Eric S. Raymond, 2015/02/10
- Re: [gpsd-dev] gpsd style change?, Greg Troxel, 2015/02/11
- Re: [gpsd-dev] gpsd style change?, Eric S. Raymond, 2015/02/11
- Re: [gpsd-dev] gpsd style change?, Greg Troxel, 2015/02/11
- Re: [gpsd-dev] gpsd style change?, Eric S. Raymond, 2015/02/11
- Re: [gpsd-dev] gpsd style change?, Greg Troxel, 2015/02/11
- Re: [gpsd-dev] gpsd style change?, Gary E. Miller, 2015/02/11
- Re: [gpsd-dev] gpsd style change?, Eric S. Raymond, 2015/02/11