6851653: (launcher) Make every java process 20 bytes smaller
Summary: Carefully keep track of every byte
Reviewed-by: ksrini, xlu
--- a/jdk/src/share/bin/java.c Sat Jun 20 13:34:06 2009 -0700
+++ b/jdk/src/share/bin/java.c Mon Jun 22 16:41:27 2009 -0700
@@ -683,10 +683,16 @@
SetClassPath(const char *s)
{
char *def;
+ const char *orig = s;
+ static const char format[] = "-Djava.class.path=%s";
s = JLI_WildcardExpandClasspath(s);
- def = JLI_MemAlloc(JLI_StrLen(s) + 40);
- sprintf(def, "-Djava.class.path=%s", s);
+ def = JLI_MemAlloc(sizeof(format)
+ - 2 /* strlen("%s") */
+ + JLI_StrLen(s));
+ sprintf(def, format, s);
AddOption(def, NULL);
+ if (s != orig)
+ JLI_MemFree((char *) s);
}
/*