VirtualBox

Changeset 1926 in kBuild


Ignore:
Timestamp:
Oct 24, 2008 4:49:58 AM (16 years ago)
Author:
bird
Message:

kmk: Inlined much of handle_function/lookup_function so variable_expand_string_2 can avoid having to make the call for every variable it encounters. Also fixed the func_char_map generation.

File:
1 edited

Legend:

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

    r1915 r1926  
    334334
    335335#if defined (CONFIG_WITH_OPTIMIZATION_HACKS) || defined (CONFIG_WITH_VALUE_LENGTH)
    336 /* The maximum length of a function, once reached there is
    337    it can't be function and we can skip the hash lookup drop out. */
    338 
    339 # define MAX_FUNCTION_LENGTH 12
    340 # define MIN_FUNCTION_LENGTH 2
    341 
    342 /* char map containing the valid function name characters. */
    343 static char func_char_map[256];
     336
     337/* Char map containing the valid function name characters. */
     338char func_char_map[256];
    344339
    345340/* Do the hash table lookup. */
     
    411406      e++;
    412407    }
    413   if (ch == '\0' || isblank ((unsigned char) ch))
     408  if (ch == '\0' || isblank (ch))
    414409    return lookup_function_in_hash_tab (s, e - s);
    415410  return 0;
     
    42964291
    42974292
    4298 int  /* bird split it up */
     4293int  /* bird split it up and hacked it. */
    42994294#ifndef CONFIG_WITH_VALUE_LENGTH
    43004295handle_function (char **op, const char **stringp)
     
    43064301}
    43074302#else  /* CONFIG_WITH_VALUE_LENGTH */
    4308 handle_function (char **op, const char **stringp, const char *eol)
     4303handle_function (char **op, const char **stringp, const char *nameend, const char *eol)
    43094304{
    43104305  const char *fname = *stringp + 1;
    4311   const struct function_table_entry *entry_p = lookup_function (fname, eol - fname);
     4306  const struct function_table_entry *entry_p =
     4307      lookup_function_in_hash_tab (fname, nameend - fname);
    43124308  if (!entry_p)
    43134309    return 0;
     
    44894485  {
    44904486    unsigned int i;
    4491     for (i = 'a'; i <= 'z'; i++)
    4492       func_char_map[i] = 1;
    4493     func_char_map[(unsigned int)'-'] = 1;
    4494 
    44954487    for (i = 0; i < FUNCTION_TABLE_ENTRIES; i++)
    44964488      {
     4489        const char *fn = function_table_init[i].name;
     4490        while (*fn)
     4491          {
     4492            func_char_map[(int)*fn] = 1;
     4493            fn++;
     4494          }
    44974495        assert (function_table_init[i].len <= MAX_FUNCTION_LENGTH);
    44984496        assert (function_table_init[i].len >= MIN_FUNCTION_LENGTH);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette