VirtualBox

Changeset 2769 in kBuild for trunk/src/kmk/variable.c


Ignore:
Timestamp:
Feb 1, 2015 12:44:30 AM (10 years ago)
Author:
bird
Message:

String expansion 'compilation' and 'execution' code is mostly done.

File:
1 edited

Legend:

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

    r2765 r2769  
    10351035  return 0;
    10361036}
     1037
     1038#ifdef CONFIG_WITH_STRCACHE2
     1039/* Alternative version of lookup_variable that takes a name that's already in
     1040   the variable string cache. */
     1041struct variable *
     1042lookup_variable_strcached (const char *name)
     1043{
     1044  struct variable *v;
     1045#if 1 /*FIX THIS - ndef KMK*/
     1046  const struct variable_set_list *setlist;
     1047  struct variable var_key;
     1048#endif /* KMK */
     1049  int is_parent = 0;
     1050
     1051#ifndef NDEBUG
     1052  strcache2_verify_entry (&variable_strcache, name);
     1053#endif
     1054
     1055#ifdef KMK
     1056  /* Check for kBuild-define- local variable accesses and handle these first. */
     1057  if (strcache2_get_len(&variable_strcache, name) > 3 && name[0] == '[')
     1058    {
     1059      v = lookup_kbuild_object_variable_accessor(name, strcache2_get_len(&variable_strcache, name));
     1060      if (v != VAR_NOT_KBUILD_ACCESSOR)
     1061        {
     1062          MAKE_STATS_2 (v->references++);
     1063          return v;
     1064        }
     1065    }
     1066#endif
     1067
     1068#if 1  /*FIX THIS - ndef KMK */
     1069
     1070  var_key.name = (char *) name;
     1071  var_key.length = strcache2_get_len(&variable_strcache, name);
     1072
     1073  for (setlist = current_variable_set_list;
     1074       setlist != 0; setlist = setlist->next)
     1075    {
     1076      const struct variable_set *set = setlist->set;
     1077
     1078      v = (struct variable *) hash_find_item_strcached ((struct hash_table *) &set->table, &var_key);
     1079      if (v && (!is_parent || !v->private_var))
     1080        {
     1081# ifdef KMK
     1082          RESOLVE_ALIAS_VARIABLE(v);
     1083# endif
     1084          MAKE_STATS_2 (v->references++);
     1085           return v->special ? lookup_special_var (v) : v;
     1086        }
     1087
     1088      is_parent |= setlist->next_is_parent;
     1089    }
     1090
     1091#else  /* KMK - need for speed */
     1092
     1093  v = lookup_cached_variable (name);
     1094  assert (lookup_variable_for_assert(name, length) == v);
     1095#ifdef VMS
     1096  if (v)
     1097#endif
     1098    return v;
     1099#endif /* KMK - need for speed */
     1100#ifdef VMS
     1101# error "Port me (split out the relevant code from lookup_varaible and call it)"
     1102#endif
     1103  return 0;
     1104}
     1105#endif
     1106
    10371107
    10381108
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