MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / lookupModule

Method lookupModule

src/jrd/flu.cpp:182–259  ·  view source on GitHub ↗

flag 'udf' means pass name-path through UdfDirectoryList

Source from the content-addressed store, hash-verified

180
181 // flag 'udf' means pass name-path through UdfDirectoryList
182 Module Module::lookupModule(const char* name)
183 {
184 Firebird::MutexLockGuard lg(modulesMutex, FB_FUNCTION);
185
186 Firebird::PathName initialModule;
187 terminate_at_space(initialModule, name);
188
189 // Look for module in array of already loaded
190 InternalModule* im = scanModule(initialModule);
191 if (im)
192 {
193 return Module(im);
194 }
195
196 // apply suffix (and/or prefix) and try that name
197 Firebird::PathName module(initialModule);
198 for (size_t i = 0; i < sizeof(libfixes) / sizeof(Libfix); i++)
199 {
200 const Libfix* l = &libfixes[i];
201 // os-dependent module name modification
202 Firebird::PathName fixedModule(module);
203 switch (l->kind)
204 {
205 case MOD_PREFIX:
206 fixedModule = l->txt + fixedModule;
207 break;
208 case MOD_SUFFIX:
209 fixedModule += l->txt;
210 }
211 if (l->permanent)
212 {
213 module = fixedModule;
214 }
215
216 // Look for module with fixed name
217 im = scanModule(fixedModule);
218 if (im)
219 {
220 return Module(im);
221 }
222
223 // UdfAccess verification
224 Firebird::PathName path, relative;
225
226 // Search for module name in UdfAccess restricted
227 // paths list
228 PathUtils::splitLastComponent(path, relative, fixedModule);
229 if (path.isEmpty() && PathUtils::isRelative(fixedModule))
230 {
231 path = fixedModule;
232 if (! iUdfDirectoryList().expandFileName(fixedModule, path))
233 {
234 // relative path was used, but no appropriate file present
235 continue;
236 }
237 }
238
239 // The module name, including directory path,

Callers

nothing calls this directly

Calls 11

terminate_at_spaceFunction · 0.85
GdsClass · 0.85
StrClass · 0.85
getDefaultMemoryPoolFunction · 0.85
InternalModuleClass · 0.85
expandFileNameMethod · 0.80
isPathInListMethod · 0.80
ModuleClass · 0.70
ERR_postFunction · 0.70
isEmptyMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected