This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
[PATCH] cinstall - Initialize all global state variables
- To: Robert Collins <robert dot collins at itdomain dot com dot au>
- Subject: [PATCH] cinstall - Initialize all global state variables
- From: Pavel Tsekov <ptsekov at syntrex dot com>
- Date: Tue, 06 Nov 2001 15:15:22 +0100
- CC: cygwin-patches at cygwin dot com
- References: <OE59HpQHyD1C0Ug8cpF00003953@hotmail.com> <1005045929.5221.0.camel@lifelesswks> <3BE7CA86.2EBAC42D@syntrex.com> <3BE7DFE6.E8062434@syntrex.com> <1005052267.2726.19.camel@lifelesswks>
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)