static int
recursive_exception_lookup(const char *name, int start, int end)
{
    int retval = start;

    int delta = (end - start) >> 1;
    int pivot = start + delta;
    int comp = strcmp(name, exception_tree[pivot].name);

    if(delta == 0)
        retval = (comp == 0) ? pivot : -1;
    else if(comp < 0)
        retval = recursive_exception_lookup(name, start, pivot);
    else if(comp == 0)
        retval = (comp == 0) ? pivot : -1;
    else
        retval = recursive_exception_lookup(name, pivot, end);

    return retval;
}
Exemple #2
0
int exception_lookup(const char* name)
{
  int retval = recursive_exception_lookup(name, 0, num_exception_names);

  if (retval < 0)
  {
    debug1 << "exception_lookup: index < 0. This means that the fake "
              "exception table contains errors! Exception name = "
           << name << endl;
    abort();
  }

  // Make the minimum value returned 100.
  return retval + 100;
}