Branch: Tag:

1998-05-27

1998-05-27 22:10:38 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Cleaned up call_provider() somewhat.

Rev: server/base_server/configuration.pike:1.135

1: - string cvs_version = "$Id: configuration.pike,v 1.134 1998/05/23 14:46:29 wing Exp $"; + string cvs_version = "$Id: configuration.pike,v 1.135 1998/05/27 22:10:38 grubba Exp $";   #include <module.h>   #include <roxen.h>   
324:   // Return an array with all provider modules that provides "provides".   array (object) get_providers(string provides)   { +  // FIXME: Is there any way to clear this cache? +  // /grubba 1998-05-28    if(!provider_module_cache[provides])    {    int i;
368:   // return the first positive response.   mixed call_provider(string provides, string fun, mixed ... args)   { -  array (object) prov = get_providers(provides); -  array error; +  foreach(get_providers(providers), object mod) { +  function f; +  if(objectp(mod) && functionp(f = mod[fun])) { +  mixed error; +  if (arrayp(error = catch {    mixed ret; -  foreach(prov, object mod) { -  if(!objectp(mod)) -  continue; -  if(functionp(mod[fun])) -  error = catch { -  ret = mod[fun](@args); -  }; -  else -  error = ret = 0; -  if(arrayp(error)) +  if (ret = f(@args)) { +  return(ret); +  } +  })) {    throw(error + ({ "Error in call_provider:"})); -  if(ret) -  return ret; +     }    } -  +  } + }      array (function) extension_modules(string ext, object id)   {