Index: trunk/src/kmk/expand.c
===================================================================
--- trunk/src/kmk/expand.c	(revision 1928)
+++ trunk/src/kmk/expand.c	(revision 1929)
@@ -1008,5 +1008,5 @@
   variable_buffer = 0;
 
-  assert (v->length == strlen (v->name));
+  assert ((unsigned int)v->length == strlen (v->name));
   val = variable_append (v->name, strlen (v->name), current_variable_set_list);
   variable_buffer_output (val, "", 1);
Index: trunk/src/kmk/read.c
===================================================================
--- trunk/src/kmk/read.c	(revision 1928)
+++ trunk/src/kmk/read.c	(revision 1929)
@@ -86,7 +86,22 @@
                                    2=already interpreted */
     char *seen_else;		/* Have we already seen an `else'?  */
+#ifdef KMK
+    char ignoring_first[8];
+    char seen_else_first[8];
+#endif
   };
 
+#ifdef KMK
+static struct conditionals toplevel_conditionals =
+{
+    0,
+    sizeof (toplevel_conditionals.ignoring_first),
+    &toplevel_conditionals.ignoring_first[0],
+    &toplevel_conditionals.seen_else_first[0],
+    "", ""
+};
+#else /* !KMK */
 static struct conditionals toplevel_conditionals;
+#endif /* !KMK */
 static struct conditionals *conditionals = &toplevel_conditionals;
 
@@ -331,5 +346,12 @@
   struct conditionals *save = conditionals;
 
+#ifndef KMK
   memset (new, '\0', sizeof (*new));
+#else  /* KMK */
+  new->if_cmds   = 0;
+  new->allocated = sizeof (new->ignoring_first);
+  new->ignoring  = new->ignoring_first;
+  new->seen_else = new->seen_else_first;
+#endif /* KMK */
   conditionals = new;
 
@@ -343,8 +365,13 @@
 {
   /* Free any space allocated by conditional_line.  */
-  if (conditionals->ignoring)
-    free (conditionals->ignoring);
-  if (conditionals->seen_else)
-    free (conditionals->seen_else);
+#ifdef KMK
+  if (conditionals->allocated > sizeof (conditionals->ignoring_first))
+#endif
+    {
+      if (conditionals->ignoring)
+        free (conditionals->ignoring);
+      if (conditionals->seen_else)
+        free (conditionals->seen_else);
+    }
 
   /* Restore state.  */
@@ -1925,4 +1952,5 @@
     }
 
+#ifndef KMK
   if (conditionals->allocated == 0)
     {
@@ -1931,13 +1959,43 @@
       conditionals->seen_else = xmalloc (conditionals->allocated);
     }
+#endif
 
   o = conditionals->if_cmds++;
   if (conditionals->if_cmds > conditionals->allocated)
     {
-      conditionals->allocated += 5;
-      conditionals->ignoring = xrealloc (conditionals->ignoring,
-                                         conditionals->allocated);
-      conditionals->seen_else = xrealloc (conditionals->seen_else,
-                                          conditionals->allocated);
+#ifdef KMK
+#if 0
+      if (conditionals->allocated == 0)
+        {
+          conditionals->allocated = sizeof (conditionals->ignoring_first);
+          conditionals->ignoring  = conditionals->ignoring_first;
+          conditionals->seen_else = conditionals->seen_else_first;
+        }
+      else
+#endif
+      if (conditionals->allocated <= sizeof (conditionals->ignoring_first))
+        {
+          assert (conditionals->allocated == sizeof (conditionals->ignoring_first));
+          conditionals->allocated += 16;
+          conditionals->ignoring = xmalloc (conditionals->allocated);
+          memcpy (conditionals->ignoring, conditionals->ignoring_first,
+                  sizeof (conditionals->ignoring_first));
+          conditionals->seen_else = xmalloc (conditionals->allocated);
+          memcpy (conditionals->seen_else, conditionals->seen_else_first,
+                  sizeof (conditionals->seen_else_first));
+        }
+      else
+        {
+          conditionals->allocated *= 2;
+#else  /* !KMK */
+          conditionals->allocated += 5;
+#endif /* !KMK */
+          conditionals->ignoring = xrealloc (conditionals->ignoring,
+                                             conditionals->allocated);
+          conditionals->seen_else = xrealloc (conditionals->seen_else,
+                                              conditionals->allocated);
+#ifdef KMK
+        }
+#endif
     }
 
@@ -2916,5 +2974,5 @@
   const char *p = *string;
   char *new = 0;
-  int slen;
+  int slen = 0;
 
   /* If the first char is a % return now.  This lets us avoid extra tests
