• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dir_list_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dir_list_free函数的典型用法代码示例。如果您正苦于以下问题:C++ dir_list_free函数的具体用法?C++ dir_list_free怎么用?C++ dir_list_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dir_list_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: deinit_shader_dir

static void deinit_shader_dir(void)
{
   // It handles NULL, no worries :D
   dir_list_free(g_extern.shader_dir.list);
   g_extern.shader_dir.list = NULL;
   g_extern.shader_dir.ptr  = 0;
}
开发者ID:dturner,项目名称:RetroArch,代码行数:7,代码来源:driver.c


示例2: find_first_libretro

static bool find_first_libretro(char *path, size_t size,
      const char *dir, const char *rom_path)
{
   bool ret = false;
   const char *ext = path_get_extension(rom_path);
   if (!ext || !*ext)
   {
      RARCH_ERR("Path has no extension. Cannot infer libretro implementation.\n");
      return false;
   }

   RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir);

   struct string_list *list = dir_list_new(dir, DYNAMIC_EXT, false);
   if (!list)
   {
      RARCH_ERR("Couldn't open directory: \"%s\".\n", dir);
      return false;
   }

   for (size_t i = 0; i < list->size && !ret; i++)
   {
      RARCH_LOG("Checking library: \"%s\".\n", list->elems[i].data);
      dylib_t lib = dylib_load(list->elems[i].data);
      if (!lib)
         continue;

      void (*proc)(struct retro_system_info*) = 
         (void (*)(struct retro_system_info*))dylib_proc(lib, "retro_get_system_info");

      if (!proc)
      {
         dylib_close(lib);
         continue;
      }

      struct retro_system_info info = {0};
      proc(&info);

      if (!info.valid_extensions)
      {
         dylib_close(lib);
         continue;
      }

      struct string_list *supported_ext = string_split(info.valid_extensions, "|"); 

      if (string_list_find_elem(supported_ext, ext))
      {
         strlcpy(path, list->elems[i].data, size);
         ret = true;
      }

      string_list_free(supported_ext);
      dylib_close(lib);
   }

   dir_list_free(list);
   return ret;
}
开发者ID:barnhilltrckn,项目名称:RetroArch-1,代码行数:60,代码来源:dynamic.c


示例3: __free

/*!
 *****************************************************************************
 *
 ****************************************************************************/
static void __free(void *data)
{
        struct dircache_entry *e = data;
        if (e)
                dir_list_free(&e->dir_entry_list);
        free(e);
}
开发者ID:hasse69,项目名称:rar2fs,代码行数:11,代码来源:dircache.c


示例4: core_info_get_name

void core_info_get_name(const char *path, char *s, size_t len)
{
   size_t i;
   settings_t             *settings = config_get_ptr();
   struct string_list *contents     = dir_list_new_special(
         settings->paths.directory_libretro,
         DIR_LIST_CORES, NULL);
   const char       *path_basedir   = !string_is_empty(settings->paths.path_libretro_info) ?
      settings->paths.path_libretro_info : settings->paths.directory_libretro;

   if (!contents)
      return;

   for (i = 0; i < contents->size; i++)
   {
      size_t path_size                = PATH_MAX_LENGTH * sizeof(char);
      char *info_path                 = NULL;
      config_file_t *conf             = NULL;
      char *new_core_name             = NULL;
      const char *current_path        = contents->elems[i].data;

      if (!string_is_equal(current_path, path))
         continue;

      info_path                       = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));
      info_path[0]                    = '\0';

      if (!core_info_list_iterate(info_path,
               path_size, path_basedir, contents, i)
            && path_is_valid(info_path))
      {
         free(info_path);
         continue;
      }

      conf = config_file_new(info_path);

      if (!conf)
      {
         free(info_path);
         continue;
      }

      if (config_get_string(conf, "corename",
            &new_core_name))
      {
         strlcpy(s, new_core_name, len);
         free(new_core_name);
      }

      config_file_free(conf);
      free(info_path);
      break;
   }

   if (contents)
      dir_list_free(contents);
   contents = NULL;
}
开发者ID:Monroe88,项目名称:RetroArch,代码行数:59,代码来源:core_info.c


示例5: shader_dir_free

static void shader_dir_free(rarch_dir_list_t *dir_list)
{
   if (!dir_list)
      return;

   dir_list_free(dir_list->list);
   dir_list->list = NULL;
   dir_list->ptr  = 0;
}
开发者ID:Sotsukun,项目名称:RetroArch,代码行数:9,代码来源:runloop.c


示例6: filebrowser_free

static void filebrowser_free(void *data)
{
   filebrowser_t *filebrowser = (filebrowser_t*)data;

   dir_list_free(filebrowser->list);
   filebrowser->list = NULL;
   filebrowser->current_dir.ptr   = 0;
   free(filebrowser);
}
开发者ID:CatalystG,项目名称:RetroArch,代码行数:9,代码来源:menu_common.c


示例7: core_info_get_name

void core_info_get_name(const char *path, char *s, size_t len)
{
   size_t i;
   core_info_t *core_info           = NULL;
   core_info_list_t *core_info_list = NULL;
   struct string_list *contents     = NULL;
   settings_t             *settings = config_get_ptr();

   if (!settings)
      return;

   contents     = dir_list_new_special(
         settings->directory.libretro,
         DIR_LIST_CORES, NULL);

   if (!contents)
      return;

   core_info_list = (core_info_list_t*)calloc(1, sizeof(*core_info_list));
   if (!core_info_list)
      goto error;

   core_info = (core_info_t*)calloc(contents->size, sizeof(*core_info));
   if (!core_info)
      goto error;

   core_info_list->list = core_info;
   core_info_list->count = contents->size;

   for (i = 0; i < contents->size; i++)
   {
      config_file_t *conf = NULL;

      if (!string_is_equal(contents->elems[i].data, path))
         continue;

      conf = core_info_list_iterate(contents, i);

      if (conf)
      {
         config_get_string(conf, "corename",
               &core_info[i].core_name);
         core_info[i].config_data = (void*)conf;
      }

      core_info[i].path = strdup(contents->elems[i].data);

      strlcpy(s, core_info[i].core_name, len);
   }

error:
   if (contents)
      dir_list_free(contents);
   contents = NULL;
   core_info_list_free(core_info_list);
}
开发者ID:KitoHo,项目名称:RetroArch,代码行数:56,代码来源:core_info.c


示例8: zarch_zui_render_lay_root_load_set_new_path

static void zarch_zui_render_lay_root_load_set_new_path(zui_t *zui, const char *newpath)
{
   if (!zui)
      return;

   free(zui->load_cwd);
   zui->load_cwd = strdup(newpath);
   dir_list_free(zui->load_dlist);
   zui->load_dlist = NULL;
}
开发者ID:bronnel,项目名称:RetroArch,代码行数:10,代码来源:zarch.c


示例9: find_and_set_first_file

static void find_and_set_first_file(void)
{
   //Last fallback - we'll need to start the first executable file 
   // we can find in the RetroArch cores directory

#if defined(_XBOX)
   char ** dir_list = dir_list_new("game:\\", ".xex");
#elif defined(__CELLOS_LV2__)
   char ** dir_list = dir_list_new(LIBRETRO_DIR_PATH, ".SELF");
#endif

   if (!dir_list)
   {
      RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
      return;
   }

   char * first_executable = dir_list[0];

   if(first_executable)
   {
#ifdef _XBOX
      //Check if it's RetroArch Salamander itself - if so, first_executable needs to
      //be overridden
      char fname_tmp[MAX_PATH_LENGTH];

      fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));

      if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
      {
         RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
	 first_executable = dir_list[1];
	 fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));

	 if(!first_executable)
	 {
            RARCH_WARN("There is no second entry - no choice but to boot RetroArch Salamander\n");
	    first_executable = dir_list[0];
	    fill_pathname_base(fname_tmp, first_executable, sizeof(fname_tmp));
	 }
      }

      snprintf(first_executable, sizeof(first_executable), "game:\\%s", fname_tmp);
#endif
      RARCH_LOG("Start first entry in libretro cores dir: [%s].\n", first_executable);
      strlcpy(libretro_path, first_executable, sizeof(libretro_path));
   }
   else
   {
      RARCH_ERR("Failed last fallback - RetroArch Salamander will exit.\n");
   }

   dir_list_free(dir_list);
}
开发者ID:magicseb,项目名称:RetroArch,代码行数:54,代码来源:main.c


示例10: find_first_libretro_core

/*We need to set libretro to the first entry in the cores
 * directory so that it will be saved to the config file
 */
static void find_first_libretro_core(char *first_file,
   size_t size_of_first_file, const char *dir,
   const char * ext)
{
   size_t i;
   bool ret = false;
   struct string_list *list = dir_list_new(dir, ext, false, true, false, false);

   if (!list)
   {
      RARCH_ERR("Couldn't read directory."
            " Cannot infer default libretro core.\n");
      return;
   }

   RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n",
         dir);
   
   for (i = 0; i < list->size && !ret; i++)
   {
      char fname[PATH_MAX_LENGTH];
      char salamander_name[PATH_MAX_LENGTH];
      const char *libretro_elem = (const char*)list->elems[i].data;

      RARCH_LOG("Checking library: \"%s\".\n", libretro_elem);

      if (!libretro_elem)
         continue;

      fill_pathname_base(fname, libretro_elem, sizeof(fname));

      if (!frontend_driver_get_salamander_basename(
               salamander_name, sizeof(salamander_name)))
         break;

      if (!strncmp(fname, salamander_name, sizeof(fname)))
      {
         if (list->size == (i + 1))
         {
            RARCH_WARN("Entry is RetroArch Salamander itself, "
                  "but is last entry. No choice but to set it.\n");
            strlcpy(first_file, fname, size_of_first_file);
         }

         continue;
      }

      strlcpy(first_file, fname, size_of_first_file);
      RARCH_LOG("First found libretro core is: \"%s\".\n", first_file);
      ret = true;
   }

   dir_list_free(list);
}
开发者ID:Skylark13,项目名称:RetroArch,代码行数:57,代码来源:frontend_salamander.c


示例11: event_set_savestate_auto_index

static void event_set_savestate_auto_index(void)
{
   size_t i;
   char state_dir[PATH_MAX_LENGTH]  = {0};
   char state_base[PATH_MAX_LENGTH] = {0};
   struct string_list *dir_list     = NULL;
   unsigned max_idx                 = 0;
   settings_t *settings             = config_get_ptr();
   global_t   *global               = global_get_ptr();

   if (!settings->savestate_auto_index)
      return;

   /* Find the file in the same directory as global->savestate_name
    * with the largest numeral suffix.
    *
    * E.g. /foo/path/content.state, will try to find
    * /foo/path/content.state%d, where %d is the largest number available.
    */

   fill_pathname_basedir(state_dir, global->savestate_name,
         sizeof(state_dir));
   fill_pathname_base(state_base, global->savestate_name,
         sizeof(state_base));

   if (!(dir_list = dir_list_new_special(state_dir, DIR_LIST_PLAIN)))
      return;

   for (i = 0; i < dir_list->size; i++)
   {
      unsigned idx;
      char elem_base[PATH_MAX_LENGTH] = {0};
      const char *end                 = NULL;
      const char *dir_elem            = dir_list->elems[i].data;

      fill_pathname_base(elem_base, dir_elem, sizeof(elem_base));

      if (strstr(elem_base, state_base) != elem_base)
         continue;

      end = dir_elem + strlen(dir_elem);
      while ((end > dir_elem) && isdigit(end[-1]))
         end--;

      idx = strtoul(end, NULL, 0);
      if (idx > max_idx)
         max_idx = idx;
   }

   dir_list_free(dir_list);

   settings->state_slot = max_idx;
   RARCH_LOG("Found last state slot: #%d\n", settings->state_slot);
}
开发者ID:hbfelizzola,项目名称:RetroArch,代码行数:54,代码来源:command_event.c


示例12: dir_free_shader

bool dir_free_shader(void)
{
   struct rarch_dir_list *dir_list = 
      (struct rarch_dir_list*)&dir_shader_list;

   dir_list_free(dir_list->list);
   dir_list->list = NULL;
   dir_list->ptr  = 0;

   return true;
}
开发者ID:Zarh,项目名称:RetroArch,代码行数:11,代码来源:dirs.c


示例13: rarch_manage_libretro_set_first_file

void rarch_manage_libretro_set_first_file(char *first_file, size_t size_of_first_file, const char *libretro_path, const char * exe_ext)
{
   //We need to set libretro to the first entry in the cores
   //directory so that it will be saved to the config file

   struct string_list *dir_list = dir_list_new(libretro_path, exe_ext, false);

   const char * first_exe;

   if (!dir_list)
   {
      RARCH_ERR("Couldn't read directory.\n");
      RARCH_ERR("Failed to set first entry to libretro path.\n");
      goto end;
   }

   first_exe = dir_list->elems[0].data;

   if(first_exe)
   {
#ifdef _XBOX
      char fname_tmp[PATH_MAX];
      fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));

      if(strcmp(fname_tmp, "RetroArch-Salamander.xex") == 0)
      {
         RARCH_WARN("First entry is RetroArch Salamander itself, increment entry by one and check if it exists.\n");
	 first_exe = dir_list->elems[1].data;
	 fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));

	 if(!first_exe)
	 {
            RARCH_ERR("Unlikely error happened - no second entry - no choice but to set it to RetroArch Salamander\n");
	    first_exe = dir_list->elems[0].data;
	    fill_pathname_base(fname_tmp, first_exe, sizeof(fname_tmp));
	 }
      }

      strlcpy(first_file, fname_tmp, size_of_first_file);
#else
      strlcpy(first_file, first_exe, size_of_first_file);
#endif
      RARCH_LOG("Set first entry in libretro core dir to libretro path: [%s].\n", first_file);
   }

end:
   dir_list_free(dir_list);
}
开发者ID:damariei,项目名称:RetroArch-Rpi,代码行数:48,代码来源:libretro_mgmt.c


示例14: find_first_libretro_core

//We need to set libretro to the first entry in the cores
//directory so that it will be saved to the config file
static void find_first_libretro_core(char *first_file,
   size_t size_of_first_file, const char *dir,
   const char * ext)
{
   struct string_list *list;
   size_t i;
   bool ret = false;

   RARCH_LOG("Searching for valid libretro implementation in: \"%s\".\n", dir);

   list = (struct string_list*)dir_list_new(dir, ext, false);
   if (!list)
   {
      RARCH_ERR("Couldn't read directory. Cannot infer default libretro core.\n");
      return;
   }
   
   for (i = 0; i < list->size && !ret; i++)
   {
      char fname[PATH_MAX];
      const char *libretro_elem = (const char*)list->elems[i].data;

      RARCH_LOG("Checking library: \"%s\".\n", libretro_elem);

      if (!libretro_elem)
         continue;

      fill_pathname_base(fname, libretro_elem, sizeof(fname));

      if (strncmp(fname, SALAMANDER_FILE, sizeof(fname)) == 0)
      {
         if ((i + 1) == list->size)
         {
            RARCH_WARN("Entry is RetroArch Salamander itself, but is last entry. No choice but to set it.\n");
            strlcpy(first_file, fname, size_of_first_file);
         }

         continue;
      }

      strlcpy(first_file, fname, size_of_first_file);
      RARCH_LOG("First found libretro core is: \"%s\".\n", first_file);
      ret = true;
   }

   dir_list_free(list);
}
开发者ID:Mbcpro,项目名称:RetroArch,代码行数:49,代码来源:frontend_salamander.c


示例15: core_info_get_name

void core_info_get_name(const char *path, char *s, size_t len)
{
   size_t i;
   settings_t             *settings = config_get_ptr();
   struct string_list *contents     = dir_list_new_special(
         settings->paths.directory_libretro,
         DIR_LIST_CORES, NULL);

   if (!contents)
      return;

   for (i = 0; i < contents->size; i++)
   {
      char info_path[PATH_MAX_LENGTH];
      config_file_t *conf             = NULL;
      char *new_core_name             = NULL;

      info_path[0]                    = '\0';

      if (!string_is_equal(contents->elems[i].data, path))
         continue;

      if (!core_info_list_iterate(info_path,
               sizeof(info_path), contents, i)
            && path_is_valid(info_path))
         continue;

      conf = config_file_new(info_path);

      if (!conf)
         continue;

      if (config_get_string(conf, "corename",
            &new_core_name))
      {
         strlcpy(s, new_core_name, len);
         free(new_core_name);
      }

      config_file_free(conf);
      break;
   }

   if (contents)
      dir_list_free(contents);
   contents = NULL;
}
开发者ID:Zarh,项目名称:RetroArch,代码行数:47,代码来源:core_info.c


示例16: find_rom_canonical_name

static int
find_rom_canonical_name(const char *hash, char *game_name, size_t max_len)
{
	// TODO: Error handling
	size_t i;
	int rv;
	int fd;
	int offs;
	char *dat_path;
	const char *dat_name;
	const char *dat_name_dot;
	struct string_list *files;

	files = dir_list_new("db", "dat", false);
	if (!files) {
		return -1;
	}

	for (i = 0; i < files->size; i++) {
		dat_path = files->elems[i].data;
		dat_name = path_basename(dat_path);

		dat_name_dot = strchr(dat_name, '.');
		if (!dat_name_dot) {
			continue;
		}

		offs = dat_name_dot - dat_name + 1;
		memcpy(game_name, dat_name, offs);

		fd = open(dat_path, O_RDONLY);
		if (fd < 0) {
			continue;
		}

		if (find_hash(fd, hash, game_name + offs, max_len - offs) == 0) {
			rv = 0;
			close(fd);
			goto clean;
		}
		close(fd);
	}
	rv = -1;
clean:
	dir_list_free(files);
	return rv;
}
开发者ID:DukedDroid,项目名称:RetroArch,代码行数:47,代码来源:main.c


示例17: directory_parse

static bool directory_parse(void *data, const char *path)
{
   filebrowser_t *filebrowser = (filebrowser_t*)data;

   struct string_list *list = dir_list_new(path,
         filebrowser->current_dir.extensions, true);
   if(!list || list->size < 1)
      return false;
   
   dir_list_sort(list, true);

   filebrowser->current_dir.ptr   = 0;
   strlcpy(filebrowser->current_dir.directory_path,
         path, sizeof(filebrowser->current_dir.directory_path));

   if (filebrowser->list)
      dir_list_free(filebrowser->list);

   filebrowser->list = list;

   return true;

}
开发者ID:CatalystG,项目名称:RetroArch,代码行数:23,代码来源:menu_common.c


示例18: gfx_ctx_drm_egl_init


//.........这里部分代码省略.........
         {
            monitor_index++;
            RARCH_LOG("[KMS/EGL]: Connector %d assigned to monitor index: #%u.\n", i, monitor_index);
         }
         drmModeFreeConnector(conn);
      }
   }

   monitor_index = 0;
   for (i = 0; i < drm->g_resources->count_connectors; i++)
   {
      drm->g_connector = drmModeGetConnector(drm->g_drm_fd,
            drm->g_resources->connectors[i]);

      if (!drm->g_connector)
         continue;
      if (drm->g_connector->connection == DRM_MODE_CONNECTED
            && drm->g_connector->count_modes > 0)
      {
         monitor_index++;
         if (monitor_index == monitor)
            break;
      }

      drmModeFreeConnector(drm->g_connector);
      drm->g_connector = NULL;
   }

   if (!drm->g_connector)
   {
      RARCH_WARN("[KMS/EGL]: Couldn't get device connector.\n");
      goto nextgpu;
   }

   for (i = 0; i < drm->g_resources->count_encoders; i++)
   {
      drm->g_encoder = drmModeGetEncoder(drm->g_drm_fd,
            drm->g_resources->encoders[i]);

      if (!drm->g_encoder)
         continue;
      if (drm->g_encoder->encoder_id == drm->g_connector->encoder_id)
         break;

      drmModeFreeEncoder(drm->g_encoder);
      drm->g_encoder = NULL;
   }

   if (!drm->g_encoder)
   {
      RARCH_WARN("[KMS/EGL]: Couldn't find DRM encoder.\n");
      goto nextgpu;
   }

   for (i = 0; i < drm->g_connector->count_modes; i++)
   {
      RARCH_LOG("[KMS/EGL]: Mode %d: (%s) %d x %d, %u Hz\n",
            i,
            drm->g_connector->modes[i].name,
            drm->g_connector->modes[i].hdisplay,
            drm->g_connector->modes[i].vdisplay,
            drm->g_connector->modes[i].vrefresh);
   }

   drm->g_crtc_id   = drm->g_encoder->crtc_id;
   drm->g_orig_crtc = drmModeGetCrtc(drm->g_drm_fd, drm->g_crtc_id);
   if (!drm->g_orig_crtc)
      RARCH_WARN("[KMS/EGL]: Cannot find original CRTC.\n");

   drm->g_connector_id = drm->g_connector->connector_id;

   /* First mode is assumed to be the "optimal" 
    * one for get_video_size() purposes. */
   drm->g_fb_width  = drm->g_connector->modes[0].hdisplay;
   drm->g_fb_height = drm->g_connector->modes[0].vdisplay;

   drm->g_gbm_dev = gbm_create_device(drm->g_drm_fd);

   if (!drm->g_gbm_dev)
   {
      RARCH_WARN("[KMS/EGL]: Couldn't create GBM device.\n");
      goto nextgpu;
   }

   dir_list_free(gpu_descriptors);

   driver.video_context_data = drm;

   return true;

error:
   dir_list_free(gpu_descriptors);

   gfx_ctx_drm_egl_destroy_resources(drm);

   if (drm)
      free(drm);

   return false;
}
开发者ID:maddox,项目名称:RetroArch,代码行数:101,代码来源:drm_egl_ctx.c


示例19: task_database_handler

static void task_database_handler(retro_task_t *task)
{
   const char *name                 = NULL;
   database_info_handle_t  *dbinfo  = NULL;
   database_state_handle_t *dbstate = NULL;
   db_handle_t *db                  = NULL;

   if (!task)
      goto task_finished;

   db      = (db_handle_t*)task->state;

   if (!db)
      goto task_finished;

   if (!db->scan_started)
   {
      db->scan_started = true;

      if (!string_is_empty(db->fullpath))
      {
         if (db->is_directory)
            db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task, db->show_hidden_files);
         else
            db->handle = database_info_file_init(db->fullpath, DATABASE_TYPE_ITERATE, task);
      }

      task_free_title(task);

      if (db->handle)
         db->handle->status = DATABASE_STATUS_ITERATE_BEGIN;
   }

   dbinfo  = db->handle;
   dbstate = &db->state;

   if (!dbinfo || task_get_cancelled(task))
      goto task_finished;

   switch (dbinfo->status)
   {
      case DATABASE_STATUS_ITERATE_BEGIN:
         if (dbstate && !dbstate->list)
         {
            if (!string_is_empty(db->content_database_path))
               dbstate->list        = dir_list_new(
                     db->content_database_path,
                     "rdb", false,
                     db->show_hidden_files,
                     false, false);

            /* If the scan path matches a database path exactly then
             * save time by only processing that database. */
            if (dbstate->list && db->is_directory)
            {
               size_t i;
               char *dirname = NULL;

               if (!string_is_empty(db->fullpath))
                  dirname    = find_last_slash(db->fullpath) + 1;

               if (!string_is_empty(dirname))
               {
                  for (i = 0; i < dbstate->list->size; i++)
                  {
                     const char *data = dbstate->list->elems[i].data;
                     char *dbname     = NULL;
                     bool strmatch    = false;
                     char *dbpath     = strdup(data);

                     path_remove_extension(dbpath);

                     dbname         = find_last_slash(dbpath) + 1;
                     strmatch       = strcasecmp(dbname, dirname) == 0;

                     free(dbpath);

                     if (strmatch)
                     {
                        struct string_list *single_list = string_list_new();
                        string_list_append(single_list,
                              data,
                              dbstate->list->elems[i].attr);
                        dir_list_free(dbstate->list);
                        dbstate->list = single_list;
                        break;
                     }
                  }
               }
            }
         }
         dbinfo->status = DATABASE_STATUS_ITERATE_START;
         break;
      case DATABASE_STATUS_ITERATE_START:
         name = database_info_get_current_element_name(dbinfo);
         task_database_cleanup_state(dbstate);
         dbstate->list_index  = 0;
         dbstate->entry_index = 0;
         task_database_iterate_start(dbinfo, name);
         break;
//.........这里部分代码省略.........
开发者ID:DoctorGoat,项目名称:RetroArch_LibNX,代码行数:101,代码来源:task_database.c


示例20: task_database_handler

static void task_database_handler(retro_task_t *task)
{
   db_handle_t *db                  = (db_handle_t*)task->state;
   database_info_handle_t  *dbinfo  = db->handle;
   database_state_handle_t *dbstate = &db->state;
   const char *name                 = dbinfo ? 
      dbinfo->list->elems[dbinfo->list_ptr].data : NULL;

   if (!dbinfo || task->cancelled)
      goto task_finished;

   switch (dbinfo->status)
   {
      case DATABASE_STATUS_ITERATE_BEGIN:
         if (dbstate && !dbstate->list)
            dbstate->list = dir_list_new_special(
                  NULL, DIR_LIST_DATABASES, NULL);
         dbinfo->status = DATABASE_STATUS_ITERATE_START;
         break;
      case DATABASE_STATUS_ITERATE_START:
         task_database_cleanup_state(dbstate);
         dbstate->list_index  = 0;
         dbstate->entry_index = 0;
         task_database_iterate_start(dbinfo, name);
         break;
      case DATABASE_STATUS_ITERATE:
         if (task_database_iterate(&db->state, dbinfo) == 0)
         {
            dbinfo->status = DATABASE_STATUS_ITERATE_NEXT;
            dbinfo->type   = DATABASE_TYPE_ITERATE;
         }
         break;
      case DATABASE_STATUS_ITERATE_NEXT:
         if (task_database_iterate_next(dbinfo) == 0)
         {
            dbinfo->status = DATABASE_STATUS_ITERATE_START;
            dbinfo->type   = DATABASE_TYPE_ITERATE;
         }
         else
         {
            runloop_msg_queue_push(
                  msg_hash_to_str(MSG_SCANNING_OF_DIRECTORY_FINISHED),
                  0, 180, true);
            goto task_finished;
         }
         break;
      default:
      case DATABASE_STATUS_FREE:
      case DATABASE_STATUS_NONE:
         goto task_finished;
   }

   return;
task_finished:
   task->finished = true;

   if (dbstate->list)
      dir_list_free(dbstate->list);

   if (db->state.buf)
      free(db->state.buf);

   if (db->handle)
      database_info_free(db->handle);

   free(dbinfo);
   free(db);
}
开发者ID:Alexandre-Garcia,项目名称:RetroArch,代码行数:68,代码来源:task_database.c



注:本文中的dir_list_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dir_open函数代码示例发布时间:2022-05-30
下一篇:
C++ dir_exists函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap