if (!handle)
return NULL;
- GList * list = handle->list;
-
- GList * itr = g_list_first(handle->list);
+ GList *itr = g_list_first(handle->list);
while (itr != NULL) {
callback_node* node = (callback_node*)itr->data;
if (node->callback == ptr)
if (!handle)
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
- GList * list = handle->list;
-
- GList * itr = g_list_first(handle->list);
+ GList *itr = g_list_first(handle->list);
while (itr != NULL) {
callback_node* node = (callback_node*)itr->data;
if (node->callback)
* limitations under the License.
*
*/
+#include <pthread.h>
#include <system_settings.h>
#include <system_settings_private.h>
{
SETTING_TRACE_BEGIN;
DIR *pDir = NULL;
- struct dirent ent, *result;
+ struct dirent *ent;
+ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
if (path == NULL) {
SETTING_TRACE("dir path is null");
if (pDir == NULL)
return -2;
- while (readdir_r(pDir, &ent, &result) == 0) {
- if (result == NULL)
- break;
-
+ pthread_mutex_lock(&mutex);
+ while ((ent = readdir(pDir)) != NULL) {
fileNodeInfo *pNode = NULL;
- if (strncmp(ent.d_name, ".", 1) == 0
- || strcmp(ent.d_name, "..") == 0)
+ if (strncmp(ent->d_name, ".", 1) == 0 || strcmp(ent->d_name, "..") == 0)
continue;
- if ((ent.d_type & DT_REG) == 0)
+ if ((ent->d_type & DT_REG) == 0)
continue;
- pNode = (fileNodeInfo *) malloc(sizeof(fileNodeInfo));
+ pNode = calloc(1, sizeof(fileNodeInfo));
if (pNode == NULL)
continue;
- memset(pNode, 0, sizeof(fileNodeInfo));
-
pNode->path = strdup(path);
- pNode->name = strdup(ent.d_name);
+ pNode->name = strdup(ent->d_name);
pNode->media_name = get_media_basename(
pNode->path, pNode->name);
*file_list = eina_list_append(*file_list, pNode);
}
+ pthread_mutex_unlock(&mutex);
+
closedir(pDir);
//SETTING_TRACE_END;
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
int ret = vconf_notify_key_changed(vconf_key, vconf_event_cb, (void *)key);
- if (ret != NULL) {
+ if (ret != 0) {
LOGE("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_notify_key_changed error");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}
return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER;
int ret = vconf_ignore_key_changed(vconf_key, vconf_event_cb);
- if (ret != NULL) {
+ if (ret != 0) {
LOGE("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_ignore_key_changed error");
return SYSTEM_SETTINGS_ERROR_IO_ERROR;
}