static void pendingtitles_action_update(ui_view* view, void* data, linked_list* items, list_item* selected, bool selectedTouched) { pendingtitles_action_data* actionData = (pendingtitles_action_data*) data; if(hidKeysDown() & KEY_B) { ui_pop(); list_destroy(view); free(data); return; } if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) { void(*action)(linked_list*, list_item*) = (void(*)(linked_list*, list_item*)) selected->data; ui_pop(); list_destroy(view); action(actionData->items, actionData->selected); free(data); return; } if(linked_list_size(items) == 0) { linked_list_add(items, &delete_pending_title); linked_list_add(items, &delete_all_pending_titles); } }
void test_linked_list(){ linked_list_t testList = 0; linked_item_t itemA; linked_item_t itemB; linked_item_t itemC; linked_item_set_user(&itemA, (void *) 0); linked_item_set_user(&itemB, (void *) 0); linked_list_add(&testList, &itemA); linked_list_add(&testList, &itemB); linked_list_add_tail(&testList, &itemC); // linked_list_remove(&testList, &itemB); linked_item_t *it; for (it = (linked_item_t *) &testList; it ; it = it->next){ if (it->next == &itemA) printf("Item A\n"); if (it->next == &itemB) printf("Item B\n"); if (it->next == &itemC) printf("Item C\n"); /* if (it->next == &itemB){ it->next = it->next; printf(" remove\n"); } else { printf(" keep\n"); */ } }
void engine_update_box (Player* player, Engine* engine) { vertex* v = player->v_buf->v; if (v->tl > -1) { linked_list_remove(engine->partitions[v->tl], v); v->tl = -1; } if (v->tr > -1) { linked_list_remove(engine->partitions[v->tr], v); v->tr = -1; } if (v->bl > -1) { linked_list_remove(engine->partitions[v->bl], v); v->bl = -1; } if (v->br > -1) { linked_list_remove(engine->partitions[v->br], v); v->br = -1; } int w = ceil(((double) engine->max_w) / BOX_SIZE); int x1 = *player->x / BOX_SIZE; int y1 = *player->y / BOX_SIZE; int x2 = (*player->x + v->bitmap->w) / BOX_SIZE; int y2 = (*player->y + v->bitmap->h) / BOX_SIZE; int idx = y1 * w + x1; if (idx < engine->partition_len) { engine->partitions[idx] = linked_list_add(engine->partitions[idx], v); v->tl = idx; } idx = y1 * w + x2; if (x2 != x1 && idx < engine->partition_len) { engine->partitions[idx] = linked_list_add(engine->partitions[idx], v); v->tr = idx; } idx = y2 * w + x1; if (y2 != y1 && idx < engine->partition_len) { engine->partitions[idx] = linked_list_add(engine->partitions[idx], v); v->bl = idx; } idx = y2 * w + x2; if (x2 != x1 && y2 != y1 && idx < engine->partition_len) { engine->partitions[idx] = linked_list_add(engine->partitions[idx], v); v->br = idx; } }
static void evg_tex_engine_fetch(struct evg_compute_unit_t *compute_unit) { struct linked_list_t *pending_queue = compute_unit->tex_engine.pending_queue; struct linked_list_t *finished_queue = compute_unit->tex_engine.finished_queue; struct evg_wavefront_t *wavefront; struct evg_uop_t *cf_uop, *uop; struct evg_work_item_uop_t *work_item_uop; struct evg_inst_t *inst; int inst_num; struct evg_work_item_t *work_item; int work_item_id; char str[MAX_LONG_STRING_SIZE]; char str_trimmed[MAX_LONG_STRING_SIZE]; /* Get wavefront to fetch from */ linked_list_head(pending_queue); cf_uop = linked_list_get(pending_queue); if (!cf_uop) return; wavefront = cf_uop->wavefront; assert(wavefront->clause_kind == EVG_CLAUSE_TEX); /* If fetch queue is full, cannot fetch until space is made */ if (compute_unit->tex_engine.fetch_queue_length >= evg_gpu_tex_engine_fetch_queue_size) return; /* Emulate instruction and create uop */ inst_num = (wavefront->clause_buf - wavefront->clause_buf_start) / 16; evg_wavefront_execute(wavefront); inst = &wavefront->tex_inst; uop = evg_uop_create(); uop->wavefront = wavefront; uop->work_group = wavefront->work_group; uop->cf_uop = cf_uop; uop->compute_unit = compute_unit; uop->id_in_compute_unit = compute_unit->gpu_uop_id_counter++; uop->last = wavefront->clause_kind != EVG_CLAUSE_TEX; uop->global_mem_read = wavefront->global_mem_read; uop->global_mem_write = wavefront->global_mem_write; uop->vliw_slots = 1; /* If TEX clause finished, extract CF uop from 'pending_queue' and * insert it into 'finished_queue'. */ if (uop->last) { linked_list_remove(pending_queue); linked_list_add(finished_queue, cf_uop); } /* If instruction is a global memory read (should be), record addresses */ if (uop->global_mem_read) { assert((inst->info->flags & EVG_INST_FLAG_MEM_READ)); EVG_FOREACH_WORK_ITEM_IN_WAVEFRONT(wavefront, work_item_id) { work_item = evg_gpu->ndrange->work_items[work_item_id]; work_item_uop = &uop->work_item_uop[work_item->id_in_wavefront]; work_item_uop->global_mem_access_addr = work_item->global_mem_access_addr; work_item_uop->global_mem_access_size = work_item->global_mem_access_size; }
int netbench_master_run(int rank, int clientsnb, options_t opts) { int tmp; struct linked_list *results; struct linked_list *process; results = linked_list_init(); process = linked_list_init(); tmp = 0; while (tmp < clientsnb) { if (tmp == rank) { tmp++; continue; } linked_list_add(process,linked_list_proc_value_init( netbench_comm_proc_recv(tmp) )); tmp++; } netbench_algo_run_master(NETBENCH_ALGO_MATRIX,results,clientsnb); netbench_printer_print(process, results, clientsnb,opts); linked_list_free(results); linked_list_free(process); return 0; }
/* Write to destination operand in ALU instruction */ void evg_isa_enqueue_write_dest(struct evg_work_item_t *work_item, struct evg_inst_t *inst, unsigned int value) { struct evg_isa_write_task_t *wt; /* If pixel is inactive, do not enqueue the task */ assert(inst->info->fmt[0] == EVG_FMT_ALU_WORD0); if (!evg_work_item_get_pred(work_item)) return; /* Fields 'dst_gpr', 'dst_rel', and 'dst_chan' are at the same bit positions in both * EVG_ALU_WORD1_OP2 and EVG_ALU_WORD1_OP3 formats. */ wt = repos_create_object(evg_isa_write_task_repos); wt->work_item = work_item; wt->kind = EVG_ISA_WRITE_TASK_WRITE_DEST; wt->inst = inst; wt->gpr = EVG_ALU_WORD1_OP2.dst_gpr; wt->rel = EVG_ALU_WORD1_OP2.dst_rel; wt->chan = EVG_ALU_WORD1_OP2.dst_chan; wt->index_mode = EVG_ALU_WORD0.index_mode; wt->value = value; /* For EVG_ALU_WORD1_OP2, check 'write_mask' field */ wt->write_mask = 1; if (inst->info->fmt[1] == EVG_FMT_ALU_WORD1_OP2 && !EVG_ALU_WORD1_OP2.write_mask) wt->write_mask = 0; /* Enqueue task */ linked_list_add(work_item->write_task_list, wt); }
struct linked_list * netbench_list_result_recv(struct linked_list *results, int rank) { struct linked_list *ret; struct netbench_result *res; unsigned int size; if (results) ret = results; else ret = linked_list_init(); size = netbench_comm_list_recv(rank); if (!size) return ret; while (size--) { res = netbench_result_recv(rank); linked_list_add(ret,linked_list_res_value_init(res)); } return ret; }
static Result action_paste_files_close_dst(void* data, u32 index, bool succeeded, u32 handle) { paste_files_data* pasteData = (paste_files_data*) data; Result res = 0; if(R_SUCCEEDED(res = FSFILE_Close(handle))) { char dstPath[FILE_PATH_MAX]; action_paste_files_get_dst_path(pasteData, index, dstPath); char parentPath[FILE_PATH_MAX]; util_get_parent_path(parentPath, dstPath, FILE_PATH_MAX); char baseDstPath[FILE_PATH_MAX]; if(pasteData->target->attributes & FS_ATTRIBUTE_DIRECTORY) { strncpy(baseDstPath, pasteData->target->path, FILE_PATH_MAX); } else { util_get_parent_path(baseDstPath, pasteData->target->path, FILE_PATH_MAX); } if(strncmp(parentPath, baseDstPath, FILE_PATH_MAX) == 0) { list_item* dstItem = NULL; if(R_SUCCEEDED(task_create_file_item(&dstItem, pasteData->target->archive, dstPath, ((file_info*) ((list_item*) linked_list_get(&pasteData->contents, index))->data)->attributes & ~FS_ATTRIBUTE_READ_ONLY))) { linked_list_add(pasteData->items, dstItem); } } } return res; }
static uint8_t persistent_rfcomm_channel(char *serviceName){ linked_item_t *it; db_mem_service_t * item; uint8_t max_channel = 1; for (it = (linked_item_t *) db_mem_services; it ; it = it->next){ item = (db_mem_service_t *) it; if (strncmp(item->service_name, serviceName, MAX_NAME_LEN) == 0) { // Match found return item->channel; } // TODO prevent overflow if (item->channel >= max_channel) max_channel = item->channel + 1; } // Allocate new persistant channel db_mem_service_t * newItem = btstack_memory_db_mem_service_get(); if (!newItem) return 0; strncpy(newItem->service_name, serviceName, MAX_NAME_LEN); newItem->channel = max_channel; linked_list_add(&db_mem_services, (linked_item_t *) newItem); return max_channel; }
void l2cap_register_service_internal(void *connection, btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t mtu){ // check for alread registered psm // TODO: emit error event l2cap_service_t *service = l2cap_get_service(psm); if (service) { log_error("l2cap_register_service_internal: PSM %u already registered\n", psm); l2cap_emit_service_registered(connection, L2CAP_SERVICE_ALREADY_REGISTERED, psm); return; } // alloc structure // TODO: emit error event service = (l2cap_service_t *) btstack_memory_l2cap_service_get(); if (!service) { log_error("l2cap_register_service_internal: no memory for l2cap_service_t\n"); l2cap_emit_service_registered(connection, BTSTACK_MEMORY_ALLOC_FAILED, psm); return; } // fill in service->psm = psm; service->mtu = mtu; service->connection = connection; service->packet_handler = packet_handler; // add to services list linked_list_add(&l2cap_services, (linked_item_t *) service); // enable page scan hci_connectable_control(1); // done l2cap_emit_service_registered(connection, 0, psm); }
static Result action_paste_files_make_dst_directory(void* data, u32 index) { paste_files_data* pasteData = (paste_files_data*) data; Result res = 0; char dstPath[FILE_PATH_MAX]; action_paste_files_get_dst_path(pasteData, index, dstPath); if(R_SUCCEEDED(res = util_ensure_dir(pasteData->target->archive, dstPath))) { char parentPath[FILE_PATH_MAX]; util_get_parent_path(parentPath, dstPath, FILE_PATH_MAX); char baseDstPath[FILE_PATH_MAX]; if(pasteData->target->attributes & FS_ATTRIBUTE_DIRECTORY) { strncpy(baseDstPath, pasteData->target->path, FILE_PATH_MAX); } else { util_get_parent_path(baseDstPath, pasteData->target->path, FILE_PATH_MAX); } if(strncmp(parentPath, baseDstPath, FILE_PATH_MAX) == 0) { list_item* dstItem = NULL; if(R_SUCCEEDED(res) && R_SUCCEEDED(task_create_file_item(&dstItem, pasteData->target->archive, dstPath))) { linked_list_add(pasteData->items, dstItem); } } } return res; }
static void put_link_key(bd_addr_t bd_addr, link_key_t link_key, link_key_type_t link_key_type){ char bd_addr_ini_string[BD_ADDR_LEN * 2 + 1]; memory_to_ini_string(bd_addr, BD_ADDR_LEN, bd_addr_ini_string); char link_key_ini_string[3 /* store link_key_type */ + LINK_KEY_LEN * 2 + 1]; uint8_t link_key_type_val = link_key_type; memory_to_ini_string(&link_key_type_val, 1, link_key_ini_string); link_key_ini_string[2] = '/'; memory_to_ini_string(link_key, LINK_KEY_LEN, link_key_ini_string + 3); ev3rt_put_bluetooth_link_key(bd_addr_ini_string, link_key_ini_string); #if 1 #else db_mem_device_link_key_t * existingRecord = (db_mem_device_link_key_t *) get_item(db_mem_link_keys, bd_addr); if (existingRecord){ memcpy(existingRecord->link_key, link_key, LINK_KEY_LEN); return; } // Record not found, create new one for this device db_mem_device_link_key_t * newItem = btstack_memory_db_mem_device_link_key_get(); if (!newItem){ newItem = (db_mem_device_link_key_t*)linked_list_get_last_item(&db_mem_link_keys); } if (!newItem) return; memcpy(newItem->device.bd_addr, bd_addr, sizeof(bd_addr_t)); memcpy(newItem->link_key, link_key, LINK_KEY_LEN); newItem->link_key_type = link_key_type; linked_list_add(&db_mem_link_keys, (linked_item_t *) newItem); #endif }
__inline__ struct linked_list * netbench_list_task_init( struct linked_list *tasks, struct linked_list *results, options_t opts ) { static struct netbench_test_info testinfolist[] = NETBENCH_TEST_INFO_LIST; struct netbench_test_info *ptr; ptr = testinfolist; while (ptr->type != NETBENCH_TEST_NONE) { if (OPT_GET(opts,ptr->optflag)) { linked_list_add(tasks,linked_list_task_value_init( netbench_task_init(ptr->type,results,1,opts) )); } ptr++; } return tasks; }
void X86CpuAddToTraceList(X86Cpu *self, struct x86_uop_t *uop) { assert(x86_tracing()); assert(!uop->in_uop_trace_list); uop->in_uop_trace_list = 1; linked_list_add(self->uop_trace_list, uop); }
static int get_link_key(bd_addr_t bd_addr, link_key_t link_key, link_key_type_t * link_key_type) { #if 1 char bd_addr_ini_string[BD_ADDR_LEN * 2 + 1]; memory_to_ini_string(bd_addr, BD_ADDR_LEN, bd_addr_ini_string); char link_key_ini_string[3 /* store link_key_type */ + LINK_KEY_LEN * 2 + 1]; if (!ev3rt_get_bluetooth_link_key(bd_addr_ini_string, link_key_ini_string)) return 0; link_key_ini_string[2] = '\0'; uint8_t link_key_type_val; ini_string_to_memory(link_key_ini_string, &link_key_type_val); *link_key_type = link_key_type_val; ini_string_to_memory(&link_key_ini_string[3], link_key); return 1; #else db_mem_device_link_key_t * item = (db_mem_device_link_key_t *) get_item(db_mem_link_keys, bd_addr); if (!item) return 0; memcpy(link_key, item->link_key, LINK_KEY_LEN); if (link_key_type) { *link_key_type = item->link_key_type; } linked_list_remove(&db_mem_link_keys, (linked_item_t *) item); linked_list_add(&db_mem_link_keys, (linked_item_t *) item); return 1; #endif }
/* Add environment variables from the actual environment plus * the list attached in the argument 'env'. */ void X86ContextAddEnv(X86Context *self, char *env) { struct x86_loader_t *loader = self->loader; extern char **environ; char *next; char *str; int i; /* Add variables from actual environment */ for (i = 0; environ[i]; i++) { str = str_set(NULL, environ[i]); linked_list_add(loader->env, str); } /* Add the environment vars provided in 'env' */ while (env) { /* Skip spaces */ while (*env == ' ') env++; if (!*env) break; /* Get new environment variable */ switch (*env) { case '"': case '\'': if (!(next = strchr(env + 1, *env))) fatal("%s: wrong format", __FUNCTION__); *next = 0; str = str_set(NULL, env + 1); linked_list_add(loader->env, str); env = next + 1; break; default: str = str_set(NULL, env); linked_list_add(loader->env, str); env = NULL; } } }
void x86_cpu_uop_trace_list_add(struct x86_uop_t *uop) { assert(x86_tracing()); assert(!uop->in_uop_trace_list); uop->in_uop_trace_list = 1; linked_list_add(x86_cpu->uop_trace_list, uop); }
void Scheduler_add_event(Scheduler *scheduler, Event *event) { event_added(event); linked_list_add(scheduler->event_list, event); char buffer[128]; sprintf( buffer, "...Event Notification: %ld - %s...", event->date.date_time, DayTime_to_string(event->slot)); send_mail("*****@*****.**", buffer); }
static void titles_options_add_entry(linked_list* items, const char* name, bool* val) { list_item* item = (list_item*) calloc(1, sizeof(list_item)); if(item != NULL) { snprintf(item->name, LIST_ITEM_NAME_MAX, "%s", name); item->color = *val ? COLOR_ENABLED : COLOR_DISABLED; item->data = val; linked_list_add(items, item); } }
void Scheduler_all_events_on(Scheduler *scheduler, Date date, linked_list *found_events) { list_iterator *iter = linked_list_begin(scheduler->event_list); while (linked_list_has_next(iter)) { Event *current = (Event*) linked_list_next(iter); if (current->date.date_time == date.date_time) linked_list_add(found_events, current); } linked_list_end(iter); }
/* Enqueue an event in the global event list. The list is accessed in a * thread-safe fashion by locking the global GLUT mutex. */ void glut_event_enqueue(struct glut_event_t *event) { /* Lock */ pthread_mutex_lock(&glut_mutex); /* Add event at tail */ linked_list_add(glut_event_list, event); /* Unlock */ pthread_mutex_unlock(&glut_mutex); }
void test_linked_list_add_and_remove () { linked_list *list = create_linked_list (); TEST_ASSERT_NOT_NULL (list); // try to append an item and get it back later char *str1 = "hello"; linked_list_append (list, str1); TEST_ASSERT_EQUAL_INT (list->item_count, 1); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 0), str1); // try to append multiple items and get one back later char *strs1[] = {"world", "!"}; linked_list_append_all (list, (void **) strs1, 2); TEST_ASSERT_EQUAL_INT (list->item_count, 3); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 0), str1); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 1), strs1[0]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 2), strs1[1]); // try to add an item at a specific position char *str2 = " "; linked_list_add (list, 1, str2); TEST_ASSERT_EQUAL_INT (list->item_count, 4); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 0), str1); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 1), str2); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 2), strs1[0]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 3), strs1[1]); // try to add multiple items at a specific position char *strs2[] = {"WORLD", "?", "\n", "HELLO "}; linked_list_add_all (list, 2, (void **) strs2, 4); TEST_ASSERT_EQUAL_INT (list->item_count, 8); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 0), str1); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 1), str2); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 2), strs2[0]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 3), strs2[1]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 4), strs2[2]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 5), strs2[3]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 6), strs1[0]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 7), strs1[1]); // try to remove an item linked_list_remove (list, 6); TEST_ASSERT_EQUAL_INT (list->item_count, 7); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 0), str1); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 1), str2); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 2), strs2[0]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 3), strs2[1]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 4), strs2[2]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 5), strs2[3]); TEST_ASSERT_EQUAL_STR (linked_list_get (list, 6), strs1[1]); delete_linked_list (list); }
void AgpsStateMachine::addSubscriber(Subscriber* subscriber) const { Subscriber* s = NULL; Notification notification((const Subscriber*)subscriber); linked_list_search(mSubscribers, (void**)&s, hasSubscriber, (void*)¬ification, false); if (NULL == s) { linked_list_add(mSubscribers, subscriber->clone(), deleteObj); } }
static void titles_action_update(ui_view* view, void* data, linked_list* items, list_item* selected, bool selectedTouched) { titles_action_data* actionData = (titles_action_data*) data; if(hidKeysDown() & KEY_B) { ui_pop(); list_destroy(view); free(data); return; } if(selected != NULL && selected->data != NULL && (selectedTouched || (hidKeysDown() & KEY_A))) { void(*action)(linked_list*, list_item*) = (void(*)(linked_list*, list_item*)) selected->data; ui_pop(); list_destroy(view); action(actionData->items, actionData->selected); free(data); return; } if(linked_list_size(items) == 0) { linked_list_add(items, &launch_title); title_info* info = (title_info*) actionData->selected->data; if(info->mediaType != MEDIATYPE_GAME_CARD) { linked_list_add(items, &delete_title); } if(!info->twl) { linked_list_add(items, &extract_smdh); if(info->mediaType != MEDIATYPE_GAME_CARD) { linked_list_add(items, &import_seed); } linked_list_add(items, &browse_save_data); if(info->mediaType != MEDIATYPE_GAME_CARD) { linked_list_add(items, &import_secure_value); linked_list_add(items, &export_secure_value); linked_list_add(items, &delete_secure_value); } } } }
static int get_link_key(bd_addr_t *bd_addr, link_key_t *link_key) { db_mem_device_link_key_t * item = (db_mem_device_link_key_t *) get_item(db_mem_link_keys, bd_addr); if (!item) return 0; memcpy(link_key, item->link_key, LINK_KEY_LEN); linked_list_remove(&db_mem_link_keys, (linked_item_t *) item); linked_list_add(&db_mem_link_keys, (linked_item_t *) item); return 1; }
static void l2cap_handle_connection_request(hci_con_handle_t handle, uint8_t sig_id, uint16_t psm, uint16_t source_cid){ log_info("l2cap_handle_connection_request for handle %u, psm %u cid %u\n", handle, psm, source_cid); l2cap_service_t *service = l2cap_get_service(psm); if (!service) { // 0x0002 PSM not supported l2cap_register_signaling_response(handle, CONNECTION_REQUEST, sig_id, 0x0002); return; } hci_connection_t * hci_connection = connection_for_handle( handle ); if (!hci_connection) { // log_error("no hci_connection for handle %u\n", handle); return; } // alloc structure // log_info("l2cap_handle_connection_request register channel\n"); l2cap_channel_t * channel = (l2cap_channel_t*) btstack_memory_l2cap_channel_get(); if (!channel){ // 0x0004 No resources available l2cap_register_signaling_response(handle, CONNECTION_REQUEST, sig_id, 0x0004); return; } // fill in BD_ADDR_COPY(channel->address, hci_connection->address); channel->psm = psm; channel->handle = handle; channel->connection = service->connection; channel->packet_handler = service->packet_handler; channel->local_cid = l2cap_next_local_cid(); channel->remote_cid = source_cid; channel->local_mtu = service->mtu; channel->remote_mtu = L2CAP_DEFAULT_MTU; channel->packets_granted = 0; channel->remote_sig_id = sig_id; // limit local mtu to max acl packet length if (channel->local_mtu > l2cap_max_mtu()) { channel->local_mtu = l2cap_max_mtu(); } // set initial state channel->state = L2CAP_STATE_WAIT_CLIENT_ACCEPT_OR_REJECT; channel->state_var = L2CAP_CHANNEL_STATE_VAR_NONE; // add to connections list linked_list_add(&l2cap_channels, (linked_item_t *) channel); // emit incoming connection request l2cap_emit_connection_request(channel); }
static int get_name(bd_addr_t bd_addr, device_name_t *device_name) { db_mem_device_name_t * item = (db_mem_device_name_t *) get_item(db_mem_names, bd_addr); if (!item) return 0; strncpy((char*)device_name, item->device_name, MAX_NAME_LEN); linked_list_remove(&db_mem_names, (linked_item_t *) item); linked_list_add(&db_mem_names, (linked_item_t *) item); return 1; }
void X86ContextAddArgsVector(X86Context *self, int argc, char **argv) { struct x86_loader_t *loader = self->loader; char *arg; int i; for (i = 0; i < argc; i++) { arg = str_set(NULL, argv[i]); linked_list_add(loader->args, arg); } }
void evg_opencl_command_queue_submit(struct evg_opencl_command_queue_t *command_queue, struct evg_opencl_command_t *command) { struct linked_list_t *command_list; /* Check that command is not enqueued */ command_list = command_queue->command_list; linked_list_find(command_list, command); if (!command_list->error_code) fatal("%s: command already enqueued", __FUNCTION__); /* Enqueue command */ linked_list_add(command_list, command); }
/** * create connection for given address * * @return connection OR NULL, if no memory left */ static hci_connection_t * create_connection_for_addr(bd_addr_t addr){ hci_connection_t * conn = btstack_memory_hci_connection_get(); if (!conn) return NULL; BD_ADDR_COPY(conn->address, addr); conn->con_handle = 0xffff; conn->authentication_flags = AUTH_FLAGS_NONE; linked_item_set_user(&conn->timeout.item, conn); conn->timeout.process = hci_connection_timeout_handler; hci_connection_timestamp(conn); conn->acl_recombination_length = 0; conn->acl_recombination_pos = 0; conn->num_acl_packets_sent = 0; linked_list_add(&hci_stack.connections, (linked_item_t *) conn); return conn; }