Ignore:
Timestamp:
Feb 1, 2015, 9:48:36 PM (10 years ago)
Author:
bird
Message:

Optimizations, tuning and bug fixes for the 'compiled' string expansion code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/expand.c

    r2770 r2771  
    190190#else  /* CONFIG_WITH_VALUE_LENGTH */
    191191  if (!v->append)
    192     value = allocated_variable_expand_2 (v->value, v->value_length, value_lenp);
     192    {
     193      if (!IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR (v))
     194        value = allocated_variable_expand_2 (v->value, v->value_length, value_lenp);
     195      else
     196        {
     197          unsigned int len = v->value_length;
     198          value = xmalloc (len + 2);
     199          memcpy (value, v->value, len + 1);
     200          value[len + 1] = '\0'; /* Extra terminator like allocated_variable_expand_2 returns. Why? */
     201          if (value_lenp)
     202            *value_lenp = len;
     203        }
     204    }
    193205  else
    194206    {
     
    312324#ifdef CONFIG_WITH_VALUE_LENGTH
    313325  assert (v->value_length == strlen (v->value));
    314   if (!v->recursive)
     326  if (!v->recursive || IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR (v))
    315327    o = variable_buffer_output (o, v->value, v->value_length);
    316328  else
     
    10101022
    10111023  /* Either expand it or copy it, depending.  */
    1012   if (! v->recursive)
     1024  if (! v->recursive || IS_VARIABLE_RECURSIVE_WITHOUT_DOLLAR (v))
    10131025#ifdef CONFIG_WITH_VALUE_LENGTH
    10141026    return variable_buffer_output (buf, v->value, v->value_length);
Note: See TracChangeset for help on using the changeset viewer.