[Patch] Override-Registry-Name (was: [Draft Patch] Debug-Personality)
Max Bowsher
maxb@ukf.net
Sat Nov 30 05:31:00 GMT 2002
Robert Collins <rbcollins@cygwin.com> wrote:
> On Sat, 2002-11-30 at 09:48, Max Bowsher wrote:
>> DEBUG already has meaning to dlmalloc.c and IniDBBuilderPackage.cc.
>> Can we choose another #define?
>> IniDBBuilderPackage.cc DEBUG puts so much to the log, that its hard
>> to see anything else, and I'm not sure I want a debug malloc unless
>> thats actually what I want to debug at the time.
>
> So only build the one file with DEBUG. Also, we don't use dlmalloc
> unless it's explicitly linked in, so it's not going to affect you.
>
> DEBUG is the right define for this IMO.
I was thinking of following up with a patch to configure.in to add a
./configure option to turn it on. I mostly understand how I might go about
adding something to CFLAGS, but I'm not aware on how I could change CFLAGS
on a per source file basis.
Max.
#########################################################
Index: mount.cc
===================================================================
RCS file: /home/max/cvsmirror/cygwin-apps-cvs/setup/mount.cc,v
retrieving revision 2.14
diff -u -p -r2.14 mount.cc
--- mount.cc 2002/05/04 04:26:01 2.14
+++ mount.cc 2002/11/29 23:14:13
@@ -74,6 +74,14 @@ enum
#include "String++.h"
+#ifdef DEBUG_MOUNT
+#include "getopt++/GetOption.h"
+#include "getopt++/StringOption.h"
+static StringOption CygwinRegistryNameOption
(CYGWIN_INFO_CYGWIN_REGISTRY_NAME, '#', "override-registry-name", "[DEBUG]
Override registry name to allow parallel installs for testing purposes");
+#undef CYGWIN_INFO_CYGWIN_REGISTRY_NAME
+#define CYGWIN_INFO_CYGWIN_REGISTRY_NAME
(((std::string)CygwinRegistryNameOption).c_str())
+#endif
+
/* Used when treating / and \ as equivalent. */
#define SLASH_P(ch) \
({ \
@@ -137,7 +145,7 @@ create_mount (String const posix, String
remove_mount (posix);
- sprintf (buf, "Software\\%s\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, posix.cstr_oneuse ());
@@ -166,7 +174,7 @@ remove1 (HKEY rkey, String const posix)
{
char buf[1000];
- sprintf (buf, "Software\\%s\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, posix.cstr_oneuse ());
@@ -223,7 +231,7 @@ set_cygdrive_flags (int istext, int issy
int found_system = 0;
char buf[1000];
- sprintf (buf, "Software\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
@@ -366,7 +374,7 @@ read_mounts ()
arbitrarily large number of mounts. */
for (int issystem = 0; issystem <= 1; issystem++)
{
- sprintf (buf, "Software\\%s\\%s\\%s",
+ snprintf (buf, sizeof(buf), "Software\\%s\\%s\\%s",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME);
#######################################################
More information about the Cygwin-apps
mailing list