This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] cinstall - Initialize all global state variables


Attached is a patch which initializes all global state
variables used in cinstall with zero values. The patch
is a result from a discussion in the cygwin maling list
about a strange behaviour of setup.exe resulting in
heavy memory usage and process crash/freeze. The following
link gives additional information about this behaviour:
http://sources.redhat.com/ml/cygwin/2001-11/msg00304.html

2001-11-06  Pavel Tsekov  <ptsekov@syntrex.com>
 
* state.cc: Initialize all global state variables to zero.
(trust_level): Remove unused state variable.
 
* state.h (trust_level): Remove unused state variable.

Robert Collins wrote:
> 
> On Wed, 2001-11-07 at 00:04, Pavel Tsekov wrote:
> > Btw what is done in state.cc is a bad habbit, IMO.
> 
> Yes. It's C style, not CPP style.
> 
> I'll approve this if you do a patch and Changelog.
> 
> NULL for everything is correct - source should be 0, as should
> net_method etc. the current code has checks for 0/NULL, but not for
> random values :].
> 
> And trust_level should be deleted if not used.
> 
> Rob
> > I would suggest the following simple changes to be
> > done ...
> >
> > There is no changelog since i'm not sure if this
> > will be approved and also I'm not sure what
> > defaults should be assigned to the root_* set
> > of variables.
diff -up /tmp/cinstall/state.cc ./state.cc
--- /tmp/cinstall/state.cc	Tue Nov  6 14:31:00 2001
+++ ./state.cc	Tue Nov  6 14:30:29 2001
@@ -17,5 +17,27 @@
 
 static char *cvsid = "\n%%% $Id: state.cc,v 2.0 2000/08/08 00:59:08 dj Exp $\n";
 
-#define extern
 #include "state.h"
+
+int      source = 0;
+
+char *   local_dir = NULL;
+
+int      root_text = 0;
+int      root_scope = 0;
+int      root_menu = 0;
+int      root_desktop = 0;
+
+int      net_method = 0;
+char *   net_proxy_host = NULL;
+int      net_proxy_port = 0;
+
+char *   net_user = NULL;
+char *   net_passwd = NULL;
+char *   net_proxy_user = NULL;
+char *   net_proxy_passwd = NULL;
+char *   net_ftp_user = NULL;
+char *   net_ftp_passwd = NULL;
+
+char *   mirror_site = NULL;
+char *   other_url = NULL;
diff -up /tmp/cinstall/state.h ./state.h
--- /tmp/cinstall/state.h	Tue Nov  6 14:31:00 2001
+++ ./state.h	Tue Nov  6 14:30:29 2001
@@ -41,6 +41,4 @@ extern char *	net_ftp_passwd;
 extern char *	mirror_site;
 extern char *	other_url;
 
-extern int	trust_level;
-
 #define MIRROR_SITE (mirror_site ? mirror_site : other_url)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]