Changeset 1445 for trunk/src/kmk


Ignore:
Timestamp:
Mar 30, 2008, 9:47:08 AM (17 years ago)
Author:
bird
Message:

Fixed evalval and evalcall - eval_buffer will change the input, so a copy of the variable is necessary.

File:
1 edited

Legend:

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

    r1443 r1445  
    15481548  if (v)
    15491549    {
     1550      char *tmp;
    15501551      char *buf;
    15511552      unsigned int len;
     
    15601561        push_new_variable_scope ();
    15611562
    1562       eval_buffer (v->value);
     1563      tmp = xmalloc (v->value_length + 1);
     1564      memcpy (tmp, v->value, v->value_length + 1);
     1565      eval_buffer (tmp);
     1566      free (tmp);
    15631567
    15641568      if (var_ctx)
     
    38443848#ifdef CONFIG_WITH_EVALPLUS
    38453849  { STRING_SIZE_TUPLE("evalctx"),       0,  1,  1,  func_evalctx},
    3846   { STRING_SIZE_TUPLE("evalval"),       0,  1,  0,  func_evalval},
    3847   { STRING_SIZE_TUPLE("evalvalctx"),    0,  1,  0,  func_evalval},
     3850  { STRING_SIZE_TUPLE("evalval"),       1,  1,  1,  func_evalval},
     3851  { STRING_SIZE_TUPLE("evalvalctx"),    1,  1,  1,  func_evalval},
    38483852  { STRING_SIZE_TUPLE("evalcall"),      1,  0,  1,  func_call},
    38493853  { STRING_SIZE_TUPLE("evalcall2"),     1,  0,  1,  func_call},
     
    39083912#endif
    39093913#ifdef CONFIG_WITH_MAKE_STATS
    3910   { STRING_SIZE_TUPLE("make-stats"),    0, ~0,  0,  func_make_stats},
     3914  { STRING_SIZE_TUPLE("make-stats"),    0,  0,  0,  func_make_stats},
    39113915#endif
    39123916#ifdef CONFIG_WITH_COMMANDS_FUNC
     
    41874191    {
    41884192      /* Evaluate the variable value directly without expanding it first.  */
     4193      char *tmp;
    41894194
    41904195      install_variable_buffer (&buf, &len);
    4191       eval_buffer (v->value);
     4196
     4197      tmp = xmalloc (v->value_length + 1);
     4198      memcpy (tmp, v->value, v->value_length + 1);
     4199      eval_buffer (tmp);
     4200      free (tmp);
     4201
    41924202      restore_variable_buffer (buf, len);
    41934203    }
Note: See TracChangeset for help on using the changeset viewer.