]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Melchior Franz:
authordavid <david>
Fri, 28 Jun 2002 19:14:42 +0000 (19:14 +0000)
committerdavid <david>
Fri, 28 Jun 2002 19:14:42 +0000 (19:14 +0000)
This patch eliminates about 10 of valgrind's "Use of uninitialised
value of size ..." messages. They are all caused by approachlist building
incomplete FGApproach class instances and then copying them into the
approchlist container, hence copying data garbage.
   I know, I couldn't win a beauty contest with this patch, but the
alternative approach -- letting operator<< always leave complete
entries -- didn't look any better. And I do only add those seemingly
useless initialization where the values would be used uninitialized
else. The constructors are only run during setup and won't slow fgfs
down at runtime.

src/ATC/approach.cxx
src/ATC/approach.hxx

index d5faedd130053ae40da5ed2f3cf4b0c6b629a39e..c3b2390fc125604d423d860b8a73a9522215c094 100644 (file)
 # include <Environment/environment.hxx>
 #endif
 
+
+PlaneApp::PlaneApp()
+:
+  ident(""),
+  lon(0.0),
+  lat(0.0),
+  alt(0.0),
+  hdg(0.0),
+  dist(0.0),
+  brg(0.0),
+  spd(0.0),
+  contact(0),
+  wpn(0),
+  dnwp(-999.),
+  dcc(0.0),
+  dnc(0.0),
+  aalt(0.0),
+  ahdg(0.0),
+  on_crs(true),
+  tlm(0.0)
+{
+}
+
 //Constructor
-FGApproach::FGApproach(){
+FGApproach::FGApproach()
+: type(0),
+  lon(0.0), lat(0.0), elev(0.0),
+  x(0.0), y(0.0), z(0.0),
+  freq(0),
+  bucket(0),
+  range(0.0),
+  active_runway(""),
+  active_rw_hdg(0.0),
+  display(false),
+  displaying(false),
+  ident(""),
+  name(""),
+  num_planes(0),
+  transmission(""),
+  first(true),
+  trans_ident(""),
+  approach_failed(false)
+{
   comm1_node = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
   comm2_node = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
 
-  num_planes = 0;
   lon_node = fgGetNode("/position/longitude-deg", true);
   lat_node = fgGetNode("/position/latitude-deg", true);
   elev_node = fgGetNode("/position/altitude-ft", true);
-  first = true;
-  active_runway = "";
-  for ( int i=0; i<max_planes; i++) {
-    planes[i].contact = 0;
-    planes[i].wpn     = 0;
-    planes[i].dnwp    = -999.;
-    planes[i].on_crs  = true;
-  }
 }
 
 //Destructor
index 5c437baf50b5ed3e2ea57c2a687a727409f22f1f..92b91e40c3424f8d193d007d02c45db3d150d1fe 100644 (file)
@@ -94,6 +94,8 @@ struct PlaneApp {
   double ahdg;           // assigned heading
   bool   on_crs;         // is the plane on course?
   double tlm;            // time when last message was sent
+
+  PlaneApp(void);
 };