Ecore_File_Monitor * ecore_file_monitor_backend_add(const char *path, void (*func) (void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path), void *data) { Ecore_File_Monitor *em; size_t len; if (!path) return NULL; if (!func) return NULL; em = calloc(1, sizeof(Ecore_File_Monitor_Poll)); if (!em) return NULL; if (!_timer) _timer = ecore_timer_add(_interval, _ecore_file_monitor_poll_handler, 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; 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 (ecore_file_exists(em->path)) { if (ecore_file_is_dir(em->path)) { /* Check for subdirs */ Eina_List *files; char *file; files = ecore_file_ls(em->path); EINA_LIST_FREE(files, file) { Ecore_File *f; char buf[PATH_MAX]; f = calloc(1, sizeof(Ecore_File)); if (!f) { free(file); continue; } snprintf(buf, sizeof(buf), "%s/%s", em->path, file); f->name = file; f->mtime = ecore_file_mod_time(buf); f->is_dir = ecore_file_is_dir(buf); em->files = (Ecore_File *) eina_inlist_append(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f)); } }
static void esql_mysac_res(Esql_Res *res) { MYSAC_ROW *row; MYSAC_RES *re; MYSAC *m; Esql_Row *r; re = res->backend.res = mysac_get_res(res->e->backend.db); if (!re) return; m = res->e->backend.db; res->desc = esql_module_desc_get(re->nb_cols, (Esql_Module_Setup_Cb)esql_module_setup_cb, res); mysac_first_row(re); row = mysac_fetch_row(re); if (!row) /* must be insert/update/etc */ { res->affected = m->affected_rows; res->id = m->insert_id; return; } res->row_count = mysac_num_rows(re); do { r = esql_row_calloc(1); EINA_SAFETY_ON_NULL_RETURN(r); r->res = res; esql_mysac_row_init(r, row); res->rows = eina_inlist_append(res->rows, EINA_INLIST_GET(r)); } while ((row = mysac_fetch_row(re))); }
EAPI Eina_Simple_XML_Attribute * eina_simple_xml_attribute_new(Eina_Simple_XML_Node_Tag *parent, const char *key, const char *value) { Eina_Simple_XML_Attribute *attr; if (!key) return NULL; attr = eina_mempool_malloc(_eina_simple_xml_attribute_mp, sizeof(*attr)); if (!attr) { ERR("could not allocate memory for attribute from mempool"); return NULL; } EINA_MAGIC_SET(attr, EINA_MAGIC_SIMPLE_XML_ATTRIBUTE); attr->parent = parent; attr->key = eina_stringshare_add(key); attr->value = eina_stringshare_add(value ? value : ""); if (parent) parent->attributes = eina_inlist_append (parent->attributes, EINA_INLIST_GET(attr)); return attr; }
static Eina_Simple_XML_Node_Data * _eina_simple_xml_node_data_new(Eina_Simple_XML_Node_Tag *parent, Eina_Simple_XML_Node_Type type, const char *content, unsigned length) { Eina_Simple_XML_Node_Data *n; if (!content) return NULL; n = malloc(sizeof(*n) + length + 1); if (!n) { ERR("could not allocate memory for node"); return NULL; } EINA_MAGIC_SET(&n->base, EINA_MAGIC_SIMPLE_XML_DATA); n->base.type = type; n->base.parent = parent; n->length = length; memcpy(n->data, content, length); n->data[length] = '\0'; if (parent) parent->children = eina_inlist_append (parent->children, EINA_INLIST_GET(&n->base)); return n; }
EAPI Eina_Simple_XML_Node_Tag * eina_simple_xml_node_tag_new(Eina_Simple_XML_Node_Tag *parent, const char *name) { Eina_Simple_XML_Node_Tag *n; if (!name) return NULL; n = eina_mempool_malloc(_eina_simple_xml_tag_mp, sizeof(*n)); if (!n) { ERR("could not allocate memory for node from mempool"); return NULL; } memset(n, 0, sizeof(*n)); EINA_MAGIC_SET(&n->base, EINA_MAGIC_SIMPLE_XML_TAG); n->base.type = EINA_SIMPLE_XML_NODE_TAG; n->base.parent = parent; n->name = eina_stringshare_add(name); if (parent) parent->children = eina_inlist_append (parent->children, EINA_INLIST_GET(&n->base)); return n; }
/** * Add a new node after the given relative item in list. * * @note this code is meant to be fast: appends are O(1) and do not * walk @a list. * * @note @a new_l is considered to be in no list. If it was in another * list before, eina_inlist_remove() it before adding. No * check of @a new_l prev and next pointers is done, so it's safe * to have them uninitialized. * * @note @a relative is considered to be inside @a list, no checks are * done to confirm that and giving nodes from different lists * will lead to problems. Giving NULL @a relative is the same as * eina_list_append(). * * @param list existing list head or NULL to create a new list. * @param new_l new list node, must not be NULL. * @param relative reference node, @a new_l will be added after it. * * @return the new list head. Use it and not @a list anymore. */ EAPI Eina_Inlist * eina_inlist_append_relative(Eina_Inlist *list, Eina_Inlist *new_l, Eina_Inlist *relative) { EINA_SAFETY_ON_NULL_RETURN_VAL(new_l, list); if (relative) { if (relative->next) { new_l->next = relative->next; relative->next->prev = new_l; } else new_l->next = NULL; relative->next = new_l; new_l->prev = relative; if (!new_l->next) list->last = new_l; return list; } return eina_inlist_append(list, new_l); }
static Eina_Bool eupnp_service_proxy_state_variable_add(Eupnp_Service_Proxy *proxy, Eupnp_State_Variable *st) { CHECK_NULL_RET(proxy, EINA_FALSE); CHECK_NULL_RET(st, EINA_FALSE); proxy->state_table = eina_inlist_append(proxy->state_table, EINA_INLIST_GET(st)); return EINA_TRUE; }
static Eina_Bool eupnp_service_proxy_action_add(Eupnp_Service_Proxy *proxy, Eupnp_Service_Action *action) { CHECK_NULL_RET(proxy, EINA_FALSE); CHECK_NULL_RET(action, EINA_FALSE); proxy->actions = eina_inlist_append(proxy->actions, EINA_INLIST_GET(action)); return EINA_TRUE; }
static Eina_Bool eupnp_service_action_argument_add(Eupnp_Service_Action *action, Eupnp_Service_Action_Argument *arg) { CHECK_NULL_RET(action, EINA_FALSE); CHECK_NULL_RET(arg, EINA_FALSE); action->arguments = eina_inlist_append(action->arguments, EINA_INLIST_GET(arg)); return EINA_TRUE; }
static Eina_Bool eupnp_service_state_variable_allowed_value_add(Eupnp_State_Variable *st, Eupnp_State_Variable_Allowed_Value *v) { CHECK_NULL_RET(st, EINA_FALSE); CHECK_NULL_RET(v, EINA_FALSE); st->allowed_value_list = eina_inlist_append(st->allowed_value_list, EINA_INLIST_GET(v)); return EINA_TRUE; }
static void _fill_data(E_Config_Dialog_Data *cfdata) { Eina_List *l; E_Quick_Access_Entry *entry; cfdata->autohide = qa_config->autohide; cfdata->hide_when_behind = qa_config->hide_when_behind; cfdata->skip_taskbar = qa_config->skip_taskbar; cfdata->skip_pager = qa_config->skip_pager; cfdata->dont_bug_me = qa_config->dont_bug_me; cfdata->first_run = qa_config->first_run; EINA_LIST_FOREACH(qa_config->entries, l, entry) cfdata->entries = eina_inlist_append(cfdata->entries, EINA_INLIST_GET(_config_entry_new(entry))); EINA_LIST_FOREACH(qa_config->transient_entries, l, entry) cfdata->transient_entries = eina_inlist_append(cfdata->transient_entries, EINA_INLIST_GET(_config_entry_new(entry))); }
EOLIAN static void _ecore_idle_enterer_after_constructor(Eo *obj, Ecore_Idle_Enterer_Data *ie, Ecore_Task_Cb func, const void *data) { _ecore_lock(); if (!_ecore_idle_enterer_add(obj, ie, func, data)) goto unlock; idle_enterers = (Ecore_Idle_Enterer_Data *)eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); unlock: _ecore_unlock(); }
/** * Useful when iterating over arrays */ EAPI Eina_Bool eldbus_message_iter_get_and_next(Eldbus_Message_Iter *iter, char signature, ...) { char type; va_list vl; ELDBUS_MESSAGE_ITERATOR_CHECK_RETVAL(iter, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(iter->writable, EINA_FALSE); va_start(vl, signature); type = dbus_message_iter_get_arg_type(&iter->dbus_iterator); if (type == DBUS_TYPE_INVALID) { va_end(vl); return EINA_FALSE; } if (type != signature) { if (signature == '(') signature = 'r'; else if (signature == '{') signature = 'e'; if (type != signature) { va_end(vl); return EINA_FALSE; } } if (dbus_type_is_basic(type)) get_basic(type, &iter->dbus_iterator, &vl); else { Eldbus_Message_Iter *sub; Eldbus_Message_Iter **iter_var = va_arg(vl, Eldbus_Message_Iter**); sub = _message_iterator_new(EINA_FALSE); if (!sub) { va_end(vl); return EINA_FALSE; } dbus_message_iter_recurse(&iter->dbus_iterator, &sub->dbus_iterator); iter->iterators = eina_inlist_append(iter->iterators, EINA_INLIST_GET(sub)); *iter_var = sub; } va_end(vl); dbus_message_iter_next(&iter->dbus_iterator); return EINA_TRUE; }
Eldbus_Message_Iter * eldbus_message_iter_sub_iter_get(Eldbus_Message_Iter *iter) { Eldbus_Message_Iter *sub; ELDBUS_MESSAGE_ITERATOR_CHECK_RETVAL(iter, NULL); EINA_SAFETY_ON_TRUE_RETURN_VAL(iter->writable, NULL); sub = _message_iterator_new(EINA_FALSE); dbus_message_iter_recurse(&iter->dbus_iterator, &sub->dbus_iterator); iter->iterators = eina_inlist_append(iter->iterators, EINA_INLIST_GET(sub)); return sub; }
static Eina_Bool _eldbus_message_iter_arguments_vget(Eldbus_Message_Iter *iter, const char *signature, va_list *aq) { int iter_type; DBusSignatureIter sig_iter; ELDBUS_MESSAGE_ITERATOR_CHECK_RETVAL(iter, EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(iter->writable, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE); EINA_SAFETY_ON_FALSE_RETURN_VAL(dbus_signature_validate(signature, NULL), EINA_FALSE); dbus_signature_iter_init(&sig_iter, signature); iter_type = dbus_message_iter_get_arg_type(&iter->dbus_iterator); while (iter_type != DBUS_TYPE_INVALID) { int sig_type = dbus_signature_iter_get_current_type(&sig_iter); if (sig_type == DBUS_TYPE_INVALID) break; if (sig_type != iter_type) { ERR("Type in iterator different of signature expected:%c got %c", iter_type, sig_type); return EINA_FALSE; } if (dbus_type_is_basic(iter_type)) get_basic(iter_type, &iter->dbus_iterator, aq); else { Eldbus_Message_Iter **user_itr = va_arg(*aq, Eldbus_Message_Iter **); Eldbus_Message_Iter *sub_itr; sub_itr = _message_iterator_new(EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(sub_itr, EINA_FALSE); dbus_message_iter_recurse(&iter->dbus_iterator, &sub_itr->dbus_iterator); iter->iterators = eina_inlist_append(iter->iterators, EINA_INLIST_GET(sub_itr)); *user_itr = sub_itr; } dbus_message_iter_next(&iter->dbus_iterator); dbus_signature_iter_next(&sig_iter); iter_type = dbus_message_iter_get_arg_type(&iter->dbus_iterator); } return dbus_signature_iter_get_current_type(&sig_iter) == DBUS_TYPE_INVALID; }
Eina_Bool shotgun_emoticon_custom_add(Shotgun_Auth *auth, const char *file, const char *text, const char *type) { Shotgun_Custom_Emoticon *emo; char *data_base64, tmp_cid[63]; size_t len, len64; const char *sha1; Eina_File *fh; const unsigned char *data; EINA_SAFETY_ON_NULL_RETURN_VAL(auth, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(file, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(text, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(type, EINA_FALSE); fh = eina_file_open(file, EINA_FALSE); if (!fh) { ERR("Couldnt open file %s", file); return EINA_FALSE; } len = eina_file_size_get(fh); data = (const unsigned char *)eina_file_map_all(fh, EINA_FILE_SEQUENTIAL); DBG("data[%p] len=%ld", data, len); DBG("data[1] = %c", data[1]); sha1 = sha1_buffer(data, len); data_base64 = shotgun_base64_encode(data, len, &len64); eina_file_map_free(fh, (void *)data); eina_file_close(fh); emo = calloc(1, sizeof(Shotgun_Custom_Emoticon)); if (!emo) return EINA_FALSE; emo->file = eina_stringshare_add(file); emo->text = strdup(text); emo->type = strdup(type); emo->data_base64 = data_base64; sprintf(tmp_cid, "cid:sha1+%[email protected]", sha1); emo->cid = strdup(tmp_cid); auth->custom_emoticons = eina_inlist_append(auth->custom_emoticons, EINA_INLIST_GET(emo)); return EINA_TRUE; }
static Comic_Chapter_Item * _comic_chapter_item_new(Comic_Chapter *cc) { Comic_Chapter_Item *cci; cci = calloc(1, sizeof(Comic_Chapter_Item)); //DBG("new item: cc %g", cc->number); _comic_chapter_item_update(cci, cc, EINA_FALSE); cc->csd->chapters = eina_inlist_remove(cc->csd->chapters, EINA_INLIST_GET(cc)); cc->csd->cs->chapters = eina_inlist_sorted_insert(cc->csd->cs->chapters, EINA_INLIST_GET(cci), (Eina_Compare_Cb)_comic_chapter_item_sort_cb); cci->chapters = eina_inlist_append(cci->chapters, EINA_INLIST_GET(cc)); cci->chapter_count++; return cci; }
/** * Add an idle enterer handler. * @param func The function to call when entering an idle state. * @param data The data to be passed to the @p func call * @return A handle to the idle enterer callback if successful. Otherwise, * NULL is returned. */ EAPI Ecore_Idle_Enterer * ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data) { Ecore_Idle_Enterer *ie; if (!func) return NULL; ie = calloc(1, sizeof(Ecore_Idle_Enterer)); if (!ie) return NULL; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); ie->func = func; ie->data = (void *)data; idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); return ie; }
static Ecore_Animator * _ecore_animator_add(Ecore_Task_Cb func, const void *data) { Ecore_Animator *animator = NULL; if (!func) return animator; animator = ecore_animator_calloc(1); if (!animator) return animator; ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR); animator->func = func; animator->data = (void *)data; animator->just_added = EINA_TRUE; animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); _begin_tick(); return animator; }
Ecore_File_Monitor * ecore_file_monitor_inotify_add(const char *path, void (*func) (void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path), void *data) { Ecore_File_Monitor *em; int len; if (_inotify_fd_pid == -1) return NULL; if (_inotify_fd_pid != getpid()) { ecore_file_monitor_inotify_shutdown(); ecore_file_monitor_inotify_init(); } em = calloc(1, sizeof(Ecore_File_Monitor_Inotify)); if (!em) 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; _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); if (ecore_file_exists(em->path)) { if (!_ecore_file_monitor_inotify_monitor(em, em->path)) return NULL; } else { ecore_file_monitor_inotify_del(em); return NULL; } return em; }
/** * Add an idle enterer handler. * @param func The function to call when entering an idle state. * @param data The data to be passed to the @p func call * @return A handle to the idle enterer callback if successful. Otherwise, * NULL is returned. * @note The function func will be called every time the main loop is entering * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 * (or ECORE_CALLBACK_CANCEL) deletes the idle enterer. */ EAPI Ecore_Idle_Enterer * ecore_idle_enterer_add(Ecore_Task_Cb func, const void *data) { Ecore_Idle_Enterer *ie = NULL; _ecore_lock(); if (!func) goto unlock; ie = ecore_idle_enterer_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); ie->func = func; ie->data = (void *)data; idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); unlock: _ecore_unlock(); return ie; }
/** * Add an idle exiter handler. * @param func The function to call when exiting an idle state. * @param data The data to be passed to the @p func call * @return A handle to the idle exiter callback on success. NULL otherwise. * @note The function func will be called every time the main loop is exiting * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 * (or ECORE_CALLBACK_CANCEL) deletes the idle exiter. */ EAPI Ecore_Idle_Exiter * ecore_idle_exiter_add(Ecore_Task_Cb func, const void *data) { Ecore_Idle_Exiter *ie = NULL; EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); _ecore_lock(); if (!func) goto unlock; ie = ecore_idle_exiter_calloc(1); if (!ie) goto unlock; ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER); ie->func = func; ie->data = (void *)data; idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie)); unlock: _ecore_unlock(); return ie; }
Shm_Handle * cserve2_shm_segment_request(Shm_Handle *shm, size_t size) { Shm_Handle *segment; size_t map_size; Shm_Mapping *map = shm->mapping; int fd; segment = calloc(1, sizeof (Shm_Handle)); if (!segment) return NULL; fd = shm_open(map->name, O_RDWR, S_IRUSR | S_IWUSR); if (fd == -1) { ERR("Could not reopen shm handle: %m"); free(segment); return NULL; } map_size = cserve2_shm_size_normalize(size, 0); map_size += map->length; if (ftruncate(fd, map_size) == -1) { ERR("Could not set the size of the shm: %m"); close(fd); free(segment); return NULL; } close(fd); segment->mapping = map; segment->map_offset = map->length; segment->map_size = map_size - map->length; segment->image_size = size; segment->image_offset = segment->map_offset; map->length = map_size; map->segments = eina_inlist_append(map->segments, EINA_INLIST_GET(segment)); return segment; }
EAPI Eldbus_Message_Iter * eldbus_message_iter_container_new(Eldbus_Message_Iter *iter, int type, const char* contained_signature) { Eldbus_Message_Iter *sub; ELDBUS_MESSAGE_ITERATOR_CHECK_RETVAL(iter, NULL); sub = _message_iterator_new(EINA_TRUE); EINA_SAFETY_ON_NULL_RETURN_VAL(sub, NULL); if (!dbus_message_iter_open_container(&iter->dbus_iterator, type, contained_signature, &sub->dbus_iterator)) goto cleanup; iter->iterators = eina_inlist_append(iter->iterators, EINA_INLIST_GET(sub)); return sub; cleanup: free(sub); return NULL; }
EOLIAN static void _ecore_idler_constructor(Eo *obj, Ecore_Idler_Data *ie, Ecore_Task_Cb func, const void *data) { if (EINA_UNLIKELY(!eina_main_loop_is())) { EINA_MAIN_LOOP_CHECK_RETURN; } ie->obj = obj; eo_manual_free_set(obj, EINA_TRUE); if (!func) { ERR("callback function must be set up for an object of class: '%s'", MY_CLASS_NAME); return; } ie->func = func; ie->data = (void *)data; idlers = (Ecore_Idler_Data *)eina_inlist_append(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie)); }
/** * Add an event handler. * @param type The type of the event this handler will get called for * @param func The function to call when the event is found in the queue * @param data A data pointer to pass to the called function @p func * @return A new Event handler, or NULL on failure * * Add an event handler to the list of handlers. This will, on success, return * a handle to the event handler object that was created, that can be used * later to remove the handler using ecore_event_handler_del(). The @p type * parameter is the integer of the event type that will trigger this callback * to be called. The callback @p func is called when this event is processed * and will be passed the event type, a pointer to the private event * structure that is specific to that event type, and a data pointer that is * provided in this call as the @p data parameter. * * When the callback @p func is called, it must return 1 or 0. If it returns * 1 (or ECORE_CALLBACK_RENEW), It will keep being called as per normal, for * each handler set up for that event type. If it returns 0 (or * ECORE_CALLBACK_CANCEL), it will cease processing handlers for that particular * event, so all handler set to handle that event type that have not already * been called, will not be. */ EAPI Ecore_Event_Handler * ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data) { Ecore_Event_Handler *eh; if (!func) return NULL; if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) return NULL; eh = calloc(1, sizeof(Ecore_Event_Handler)); if (!eh) return NULL; ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER); eh->type = type; eh->func = func; eh->data = (void *)data; if (type >= (event_handlers_num - 1)) { int p_alloc_num; p_alloc_num = event_handlers_alloc_num; event_handlers_num = type + 1; if (event_handlers_num > event_handlers_alloc_num) { Ecore_Event_Handler **new_handlers; int i; event_handlers_alloc_num = ((event_handlers_num + 16) / 16) * 16; new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *)); if (!new_handlers) { free(eh); return NULL; } event_handlers = new_handlers; for (i = p_alloc_num; i < event_handlers_alloc_num; i++) event_handlers[i] = NULL; } } event_handlers[type] = (Ecore_Event_Handler *) eina_inlist_append(EINA_INLIST_GET(event_handlers[type]), EINA_INLIST_GET(eh)); return eh; }
static void esql_postgresql_res(Esql_Res *res) { Esql_Row *r; PGresult *pres; int i; pres = res->backend.res = PQgetResult(res->e->backend.db); EINA_SAFETY_ON_NULL_RETURN(pres); switch (PQresultStatus(pres)) { case PGRES_COMMAND_OK: { const char *a; a = PQcmdTuples(pres); if (a && (*a)) res->affected = strtol(a, NULL, 10); res->id = PQoidValue(pres); } return; case PGRES_TUPLES_OK: break; default: res->error = PQresultErrorMessage(pres); ERR("Error %s:'%s'!", PQresStatus(PQresultStatus(pres)), res->error); return; } res->desc = esql_module_desc_get(PQntuples(pres), (Esql_Module_Setup_Cb)esql_module_setup_cb, res); for (i = 0; i < res->row_count; i++) { r = esql_row_calloc(1); EINA_SAFETY_ON_NULL_RETURN(r); r->res = res; esql_postgresql_row_init(r, i); res->rows = eina_inlist_append(res->rows, EINA_INLIST_GET(r)); } }
/** * Add a animator to tick off at every animaton tick during main loop execution. * @param func The function to call when it ticks off * @param data The data to pass to the function * @return A handle to the new animator * @ingroup Ecore_Animator_Group * * This function adds a animator and returns its handle on success and NULL on * failure. The function @p func will be called every N seconds where N is the * frametime interval set by ecore_animator_frametime_set(). The function will * be passed the @p data pointer as its parameter. * * When the animator @p func is called, it must return a value of either 1 or 0. * If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at the * next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be deleted * automatically making any references/handles for it invalid. */ EAPI Ecore_Animator * ecore_animator_add(Ecore_Task_Cb func, const void *data) { Ecore_Animator *animator; if (!func) return NULL; animator = calloc(1, sizeof(Ecore_Animator)); if (!animator) return NULL; ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR); animator->func = func; animator->data = (void *)data; animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); if (!timer) { double t_loop = ecore_loop_time_get(); double sync_0 = 0.0; double d = -fmod(t_loop - sync_0, animators_frametime); timer = ecore_timer_loop_add(animators_frametime, _ecore_animator, NULL); ecore_timer_delay(timer, d); } return animator; }
/* local functions */ void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id) { Ecore_Wl_Input *input; LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!(input = malloc(sizeof(Ecore_Wl_Input)))) return; memset(input, 0, sizeof(Ecore_Wl_Input)); input->display = ewd; input->pointer_focus = NULL; input->keyboard_focus = NULL; input->touch_focus = NULL; input->seat = wl_registry_bind(ewd->wl.registry, id, &wl_seat_interface, 1); ewd->inputs = eina_inlist_append(ewd->inputs, EINA_INLIST_GET(input)); wl_seat_add_listener(input->seat, &_ecore_wl_seat_listener, input); wl_seat_set_user_data(input->seat, input); wl_array_init(&input->data_types); if (ewd->wl.data_device_manager) { input->data_device = wl_data_device_manager_get_data_device(ewd->wl.data_device_manager, input->seat); wl_data_device_add_listener(input->data_device, &_ecore_wl_data_listener, input); } ewd->input = input; }
static Eina_Bool _eldbus_message_iter_arguments_vappend(Eldbus_Message_Iter *iter, const char *signature, va_list *aq) { DBusSignatureIter signature_iter; Eina_Bool r = EINA_TRUE; char *type; ELDBUS_MESSAGE_ITERATOR_CHECK_RETVAL(iter, EINA_FALSE); EINA_SAFETY_ON_FALSE_RETURN_VAL(iter->writable, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(signature, EINA_FALSE); dbus_signature_iter_init(&signature_iter, signature); while ((type = dbus_signature_iter_get_signature(&signature_iter))) { if (type[0] != DBUS_TYPE_VARIANT && !type[1]) r = append_basic(type[0], aq, &iter->dbus_iterator); else { Eldbus_Message_Iter **user_itr; Eldbus_Message_Iter *sub; user_itr = va_arg(*aq, Eldbus_Message_Iter **); sub = _message_iterator_new(EINA_TRUE); if (!sub) { ERR("Could not create sub iterator"); r = EINA_FALSE; goto next; } iter->iterators = eina_inlist_append(iter->iterators, EINA_INLIST_GET(sub)); if (type[0] == DBUS_TYPE_ARRAY) r = dbus_message_iter_open_container(&iter->dbus_iterator, type[0], type+1, &sub->dbus_iterator); else if (type[1] == DBUS_TYPE_VARIANT) { ERR("variant not supported by \ eldbus_message_iter_arguments_append(), \ try eldbus_message_iter_container_new()"); r = EINA_FALSE; goto next; } else { char real_type; if (type[0] == DBUS_STRUCT_BEGIN_CHAR) real_type = DBUS_TYPE_STRUCT; else real_type = DBUS_TYPE_DICT_ENTRY; r = dbus_message_iter_open_container(&iter->dbus_iterator, real_type, NULL, &sub->dbus_iterator); } *user_itr = sub; } next: dbus_free(type); if (!r || !dbus_signature_iter_next(&signature_iter)) break; } return r; }