static void *
subdir_cache_hash_add(void *hash, const char *key, void *data)
{
- if (!hash) hash = eina_hash_string_superfast_new(EINA_FREE_CB(subdir_cache_dir_free));
+ if (!hash) hash = eina_hash_stringshared_new(EINA_FREE_CB(subdir_cache_dir_free));
if (!hash) return NULL;
eina_hash_add(hash, key, data);
return hash;
// if we don't have a hash in the subdir cache - allocate it
if (!subdir_cache->dirs)
- subdir_cache->dirs = eina_hash_string_superfast_new(EINA_FREE_CB(subdir_cache_dir_free));
+ subdir_cache->dirs = eina_hash_stringshared_new(EINA_FREE_CB(subdir_cache_dir_free));
}
static void
if ((!icon_flush) && (!icon_exts)) return ECORE_CALLBACK_CANCEL;
if (icon_change_monitors) eina_hash_free(icon_change_monitors);
- icon_change_monitors = eina_hash_string_superfast_new
+ icon_change_monitors = eina_hash_stringshared_new
(EINA_FREE_CB(ecore_file_monitor_del));
icon_changes_listen();
subdir_cache_save();
desktop_queue = EINA_FALSE;
if (desktop_change_monitors) eina_hash_free(desktop_change_monitors);
- desktop_change_monitors = eina_hash_string_superfast_new
+ desktop_change_monitors = eina_hash_stringshared_new
(EINA_FREE_CB(ecore_file_monitor_del));
desktop_changes_listen();
subdir_cache_save();
goto error;
}
- icon_change_monitors = eina_hash_string_superfast_new
+ icon_change_monitors = eina_hash_stringshared_new
(EINA_FREE_CB(ecore_file_monitor_del));
- desktop_change_monitors = eina_hash_string_superfast_new
+ desktop_change_monitors = eina_hash_stringshared_new
(EINA_FREE_CB(ecore_file_monitor_del));
efreet_cache_update = 0;
void *data)
{
Ecore_File_Monitor *em;
- int len;
+ char *path2;
+ size_t len;
if (_inotify_fd_pid == -1) return NULL;
em->func = func;
em->data = data;
- em->path = strdup(path);
- len = strlen(em->path);
- if (em->path[len - 1] == '/' && strcmp(em->path, "/"))
- em->path[len - 1] = 0;
+ len = strlen(path);
+ path2 = alloca(len + 1);
+ if (path2[len - 1] == '/' && strcmp(path2, "/")) path2[len - 1] = 0;
+ em->path = eina_stringshare_add(path2);
_monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
fd = ecore_main_fd_handler_fd_get(_fdh);
if (ECORE_FILE_MONITOR_INOTIFY(em)->wd)
inotify_rm_watch(fd, ECORE_FILE_MONITOR_INOTIFY(em)->wd);
- free(em->path);
+ eina_stringshare_del(em->path);
free(em);
}
void *data)
{
Ecore_File_Monitor *em;
+ char *path2;
size_t len;
if (!path) return NULL;
else
ecore_timer_interval_set(_timer, ECORE_FILE_INTERVAL_MIN);
- em->path = strdup(path);
- len = strlen(em->path);
- if (em->path[len - 1] == '/' && strcmp(em->path, "/"))
- em->path[len - 1] = 0;
-
em->func = func;
em->data = data;
+ len = strlen(path);
+ path2 = alloca(len + 1);
+ if (path2[len - 1] == '/' && strcmp(path2, "/")) path2[len - 1] = 0;
+ em->path = eina_stringshare_add(path2);
+
ECORE_FILE_MONITOR_POLL(em)->mtime = ecore_file_mod_time(em->path);
_monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
if (_monitors)
_monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em)));
- free(em->path);
+ eina_stringshare_del(em->path);
free(em);
if (_timer)
{
Ecore_File_Monitor_Win32 *m;
Ecore_File_Monitor *em;
+ char *path2;
size_t len;
if (!path || (*path == '\0')) return NULL;
em->func = func;
em->data = data;
- em->path = strdup(path);
- if (!em->path)
- {
- free(em);
- return NULL;
- }
- len = strlen(em->path);
- if (em->path[len - 1] == '/' || em->path[len - 1] == '\\')
- em->path[len - 1] = '\0';
+ len = strlen(path);
+ path2 = alloca(len + 1);
+ if (path2[len - 1] == '/' || path2[len - 1] == '\\') path2[len - 1] = 0;
+ em->path = eina_stringshare_add(path2);
m = ECORE_FILE_MONITOR_WIN32(em);
m->file = _ecore_file_monitor_win32_data_new(em, 0);
if (!m->file)
{
- free(em->path);
+ eina_stringshare_del(em->path);
free(em);
return NULL;
}
if (!m->dir)
{
_ecore_file_monitor_win32_data_free(m->file);
- free(em->path);
+ eina_stringshare_del(em->path);
free(em);
return NULL;
}
m = ECORE_FILE_MONITOR_WIN32(em);
_ecore_file_monitor_win32_data_free(m->dir);
_ecore_file_monitor_win32_data_free(m->file);
- free(em->path);
+ eina_stringshare_del(em->path);
free(em);
}
Ecore_File_Event event,
const char *path);
- char *path;
+ const char *path;
void *data;
Ecore_File *files;
};