Index: /trunk/src/kmk/function.c
===================================================================
--- /trunk/src/kmk/function.c	(revision 3316)
+++ /trunk/src/kmk/function.c	(revision 3317)
@@ -3850,9 +3850,11 @@
                   }
                 else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                if (!d->need_2nd_expansion)
                   total_len += strcache2_get_len (&file_strcache, c) + 1;
-#else
+                else
+#endif
                   total_len += strlen (c) + 1;
-#endif
               }
 
@@ -3877,9 +3879,11 @@
                       }
                     else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                    if (!d->need_2nd_expansion)
                       len = strcache2_get_len (&file_strcache, c) + 1;
-#else
+                    else
+#endif
                       len = strlen (c) + 1;
-#endif
                     o = variable_buffer_output (o, c, len);
                     o[-1] = FILE_LIST_SEPARATOR;
@@ -3909,9 +3913,11 @@
                       }
                     else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                    if (!d->need_2nd_expansion)
                       len = strcache2_get_len (&file_strcache, c);
-#else
+                    else
+#endif
                       len = strlen (c);
-#endif
                     o = variable_buffer_output (o, c, len);
                     break;
@@ -3987,9 +3993,11 @@
                   }
                 else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                if (!d->need_2nd_expansion)
                   total_len += strcache2_get_len (&file_strcache, c) + 1;
-#else
+                else
+#endif
                   total_len += strlen (c) + 1;
-#endif
               }
 
@@ -4014,9 +4022,11 @@
                       }
                     else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                    if (!d->need_2nd_expansion)
                       len = strcache2_get_len (&file_strcache, c) + 1;
-#else
+                    else
+#endif
                       len = strlen (c) + 1;
-#endif
                     o = variable_buffer_output (o, c, len);
                     o[-1] = FILE_LIST_SEPARATOR;
@@ -4046,9 +4056,11 @@
                       }
                     else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                    if (!d->need_2nd_expansion)
                       len = strcache2_get_len (&file_strcache, c);
-#else
+                    else
+#endif
                       len = strlen (c);
-#endif
                     o = variable_buffer_output (o, c, len);
                     break;
@@ -4124,9 +4136,11 @@
                   }
                 else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                if (!d->need_2nd_expansion)
                   total_len += strcache2_get_len (&file_strcache, c) + 1;
-#else
+                else
+#endif
                   total_len += strlen (c) + 1;
-#endif
               }
 
@@ -4151,9 +4165,11 @@
                       }
                     else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                    if (!d->need_2nd_expansion)
                       len = strcache2_get_len (&file_strcache, c) + 1;
-#else
+                    else
+#endif
                       len = strlen (c) + 1;
-#endif
                     o = variable_buffer_output (o, c, len);
                     o[-1] = FILE_LIST_SEPARATOR;
@@ -4183,9 +4199,11 @@
                       }
                     else
-#elif defined (CONFIG_WITH_STRCACHE2)
+#endif
+#ifdef CONFIG_WITH_STRCACHE2
+                    if (!d->need_2nd_expansion)
                       len = strcache2_get_len (&file_strcache, c);
-#else
+                    else
+#endif
                       len = strlen (c);
-#endif
                     o = variable_buffer_output (o, c, len);
                     break;
