Ignore:
Timestamp:
Oct 28, 2008, 12:25:49 AM (17 years ago)
Author:
bird
Message:

kmk: Some cleanup.

File:
1 edited

Legend:

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

    r1975 r1980  
    8181      unsigned int offset = ptr - variable_buffer;
    8282      variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length
    83                                ? newlen + 100
    84                                : 2 * variable_buffer_length);
     83                                ? newlen + 100
     84                                : 2 * variable_buffer_length);
    8585      variable_buffer = xrealloc (variable_buffer, variable_buffer_length);
    8686      ptr = variable_buffer + offset;
     
    116116      variable_buffer[0] = '\0';
    117117    }
    118 #else
     118#else  /* CONFIG_WITH_VALUE_LENGTH */
    119119  if (variable_buffer == 0)
    120120    {
     
    123123      variable_buffer[0] = '\0';
    124124    }
    125 #endif
     125#endif /* CONFIG_WITH_VALUE_LENGTH */
    126126
    127127  return variable_buffer;
     
    210210/* Expand a simple reference to variable NAME, which is LENGTH chars long.  */
    211211
    212 #if defined(__GNUC__) || defined(_MSC_VER) /* bird added MSC */
     212#if defined(__GNUC__)
    213213__inline
     214#elif defined (MY_INLINE) /* bird */
     215MY_INLINE
    214216#endif
    215217static char *
     
    236238     unsigned int value_len;
    237239
     240     /* XXX: Inline recursively_expand_for_file() here and what it calls, try
     241             make use of O directly instead wasting time on an intermediate buffer.  */
    238242     value = recursively_expand_for_file (v, NULL, &value_len);
    239243     o = variable_buffer_output (o, value, value_len);
     
    760764#ifndef CONFIG_WITH_VALUE_LENGTH
    761765  return variable_expand_string(NULL, line, (long)-1);
    762 #else
     766#else  /* CONFIG_WITH_VALUE_LENGTH */
    763767  char *s;
    764768
     
    770774    }
    771775  return variable_expand_string_2 (NULL, line, (long)-1, &s);
    772 #endif
     776#endif /* CONFIG_WITH_VALUE_LENGTH */
    773777}
    774778
     
    793797  if (!end || *end == '\0')
    794798    return allocated_variable_expand (str);
     799
    795800  tmp = alloca (end - str + 1);
    796801  memcpy (tmp, str, end - str);
    797802  tmp[end - str] = '\0';
     803
    798804  return allocated_variable_expand (tmp);
    799805#else  /* CONFIG_WITH_VALUE_LENGTH */
     
    844850{
    845851  char *result;
    846   struct variable_set_list *save;
    847   const struct floc *reading_file_saved;
     852  struct variable_set_list *savev;
     853  const struct floc *savef;
    848854  long len = length == ~0U ? (long)-1 : (long)length;
    849855  char *eol;
     
    856862  else
    857863    {
    858       save = current_variable_set_list;
     864      savev = current_variable_set_list;
    859865      current_variable_set_list = file->variables;
    860       reading_file_saved = reading_file;
     866
     867      savef = reading_file;
    861868      if (file->cmds && file->cmds->fileinfo.filenm)
    862869        reading_file = &file->cmds->fileinfo;
    863870      else
    864871        reading_file = 0;
     872
    865873      result = variable_expand_string_2 (o, line, len, &eol);
    866       current_variable_set_list = save;
    867       reading_file = reading_file_saved;
     874
     875      current_variable_set_list = savev;
     876      reading_file = savef;
    868877    }
    869878
     
    10061015  variable_buffer = 0;
    10071016
    1008   assert ((unsigned int)v->length == strlen (v->name));
     1017  assert ((unsigned int)v->length == strlen (v->name)); /* bird */
    10091018  val = variable_append (v->name, strlen (v->name), current_variable_set_list);
    10101019  variable_buffer_output (val, "", 1);
Note: See TracChangeset for help on using the changeset viewer.