Lines Matching refs:mlc
200 module_list_cookie * mlc; in open_module_list() local
206 mlc = (module_list_cookie *) malloc(sizeof(*mlc)); in open_module_list()
207 mlc->prefix = strdup(prefix); in open_module_list()
210 mlc->search_paths = (addon_path ? strdup(addon_path) : NULL); in open_module_list()
211 mlc->search_path = strtok_r(mlc->search_paths, ":", &mlc->next_path_token); in open_module_list()
212 mlc->dir_stack = new BList(); in open_module_list()
214 mlc->ma = NULL; in open_module_list()
215 mlc->mi = NULL; in open_module_list()
217 return mlc; in open_module_list()
223 module_list_cookie * mlc = (module_list_cookie *) cookie; in read_next_module_name() local
228 if (!mlc) in read_next_module_name()
242 if (mlc->ma && mlc->mi) { in read_next_module_name()
245 while (*mlc->mi) { in read_next_module_name()
246 module_info * mi = *mlc->mi; in read_next_module_name()
247 mlc->mi++; in read_next_module_name()
248 if(strstr(mi->name, mlc->prefix)) { in read_next_module_name()
257 atomic_add(&mlc->ma->ref_count, -1); in read_next_module_name()
258 unload_module_addon(mlc->ma); in read_next_module_name()
259 mlc->ma = NULL; in read_next_module_name()
260 mlc->mi = NULL; in read_next_module_name()
264 while (mlc->search_path) { in read_next_module_name()
271 dir = (BDirectory *) mlc->dir_stack->LastItem(); in read_next_module_name()
274 if (strncmp(mlc->search_path, "%A/", 3) == 0) { in read_next_module_name()
282 path.Append(mlc->search_path + 3); in read_next_module_name()
284 path.SetTo(mlc->search_path); in read_next_module_name()
288 path.Append(mlc->prefix); in read_next_module_name()
294 mlc->dir_stack->AddItem(dir); in read_next_module_name()
310 mlc->dir_stack->AddItem(subdir); in read_next_module_name()
316 mlc->ma = load_module_addon(path.Path()); in read_next_module_name()
317 if (!mlc->ma) in read_next_module_name()
322 atomic_add(&mlc->ma->ref_count, 1); in read_next_module_name()
325 mlc->mi = mlc->ma->infos; in read_next_module_name()
331 status = mlc->dir_stack->RemoveItem(dir); in read_next_module_name()
335 if (!mlc->dir_stack->IsEmpty()) in read_next_module_name()
339 mlc->search_path = strtok_r(NULL, ":", &mlc->next_path_token); in read_next_module_name()
349 module_list_cookie * mlc = (module_list_cookie *) cookie; in close_module_list() local
352 ASSERT(mlc); in close_module_list()
353 ASSERT(mlc->prefix); in close_module_list()
355 if (mlc->ma) { in close_module_list()
356 atomic_add(&mlc->ma->ref_count, -1); in close_module_list()
357 unload_module_addon(mlc->ma); in close_module_list()
360 while((dir = (BDirectory *) mlc->dir_stack->FirstItem())) { in close_module_list()
361 mlc->dir_stack->RemoveItem(dir); in close_module_list()
365 delete mlc->dir_stack; in close_module_list()
367 free(mlc->search_paths); in close_module_list()
368 free(mlc->prefix); in close_module_list()
369 free(mlc); in close_module_list()