Ignore:
Timestamp:
Sep 18, 2006, 5:02:39 AM (19 years ago)
Author:
bird
Message:

o Optimization summary: libc from ~21 seconds -> 7-8 seconds (os2/nt).
o Optimized appending new stuff to variables. (major win)
o Optimized variable memory value allocation avoiding a bunch of

unnecessary copying and allocating.

File:
1 edited

Legend:

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

    r530 r533  
    537537}
    538538
     539#ifdef CONFIG_WITH_VALUE_LENGTH
     540/* Expands the specified string, appending it to the specified variable value. */
     541void
     542append_expanded_string_to_variable (struct variable *v, char *value)
     543{
     544  char *p;
     545
     546  /* switch the variable buffer to the variable value buffer. */
     547  char *saved_buffer = variable_buffer;
     548  unsigned int saved_buffer_length = variable_buffer_length;
     549  variable_buffer = v->value;
     550  variable_buffer_length = v->value_alloc_len;
     551
     552  /* skip the current value and start appending a space and the expanded string. */
     553  p = v->value + v->value_length;
     554  if (v->value_length != 0)
     555      p = variable_buffer_output (p, " ", 1);
     556  p = variable_expand_string (p, value, (long)-1);
     557
     558  /* update the variable. (The variable_expand_string return is annoying!) */
     559  p = strchr (p, '\0');
     560  v->value = variable_buffer;
     561  v->value_length = p - v->value;
     562  v->value_alloc_len = variable_buffer_length;
     563
     564  /* restore the variable buffer. */
     565  variable_buffer = saved_buffer;
     566  variable_buffer_length = saved_buffer_length;
     567}
     568#endif /* CONFIG_WITH_VALUE_LENGTH */
    539569
    540570static char *
Note: See TracChangeset for help on using the changeset viewer.