本文整理汇总了C++中delete_list函数的典型用法代码示例。如果您正苦于以下问题:C++ delete_list函数的具体用法?C++ delete_list怎么用?C++ delete_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_list函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init_acpi_fan
/* reads the names of the fan directories, fills fan_t,
* return 0 on success, negative values on errors */
int
init_acpi_fan(global_t *globals){
char *names[MAX_ITEMS];
list_t *lst = NULL;
node_t *node = NULL;
int i = 0;
fan_t *finfo = NULL;
globals->fan_count = 0;
if((lst = dir_list(PROC_ACPI "fan")) == NULL || !lst->top)
return NOT_SUPPORTED;
for(node = lst->top; node; node = node->next){
if((names[globals->fan_count] = strdup(node->name)) == NULL){
delete_list(lst);
return ALLOC_ERR;
}
globals->fan_count++;
}
if(globals->fan_count > MAX_ITEMS) return ITEM_EXCEED;
for (; i < globals->fan_count && i < MAX_ITEMS; i++){
finfo = &fans[i];
snprintf(finfo->name, MAX_NAME, "%s", names[i]);
snprintf(finfo->state_file, MAX_NAME, PROC_ACPI "fan/%s/state", names[i]);
free(names[i]);
}
delete_list(lst);
read_acpi_fans(globals);
return SUCCESS;
}
开发者ID:GiuseppeMassari,项目名称:libacpi,代码行数:33,代码来源:libacpi.c
示例2: init_acpi_thermal
/* reads the name of the thermal-zone directory and fills the adapter_t
* structure with the name and the state-file. Return 0 on success, negative values on errors */
int
init_acpi_thermal(global_t *globals){
char *names[MAX_ITEMS];
list_t *lst = NULL;
node_t *node = NULL;
thermal_t *tinfo = NULL;
int i = 0;
globals->thermal_count = 0;
if((lst = dir_list(PROC_ACPI "thermal_zone")) == NULL)
return NOT_SUPPORTED;
for(node = lst->top; node; node = node->next){
if((names[globals->thermal_count] = strdup(node->name)) == NULL){
delete_list(lst);
return ALLOC_ERR;
}
globals->thermal_count++;
}
if(globals->thermal_count > MAX_ITEMS) return ITEM_EXCEED;
for (; i < globals->thermal_count && i < MAX_ITEMS; i++){
tinfo = &thermals[i];
snprintf(tinfo->name, MAX_NAME, "%s", names[i]);
snprintf(tinfo->state_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/state", names[i]);
snprintf(tinfo->temp_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/temperature", names[i]);
snprintf(tinfo->cooling_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/cooling_mode", names[i]);
snprintf(tinfo->freq_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/polling_frequency", names[i]);
snprintf(tinfo->trips_file, MAX_NAME, PROC_ACPI "thermal_zone/%s/trip_points", names[i]);
free(names[i]);
}
delete_list(lst);
read_acpi_thermalzones(globals);
return SUCCESS;
}
开发者ID:GiuseppeMassari,项目名称:libacpi,代码行数:37,代码来源:libacpi.c
示例3: init_acpi_acadapt
/* reads the name of the ac-adapter directory and fills the adapter_t
* structure with the name and the state-file. Return 0 on success, negative values on errors */
int
init_acpi_acadapt(global_t *globals){
list_t *lst = NULL;
adapter_t *ac = &globals->adapt;
globals->sysstyle = 0;
if((lst = dir_list(PROC_ACPI "ac_adapter")) == NULL || !lst->top)
{
if((lst = dir_list(SYS_POWER "/AC")) == NULL || !lst->top)
return NOT_SUPPORTED;
else
globals->sysstyle = 1;
}
if((!lst->top->name || ((ac->name = strdup(lst->top->name)) == NULL))){
delete_list(lst);
return ALLOC_ERR;
}
if(globals->sysstyle)
snprintf(ac->state_file, MAX_NAME, SYS_POWER "/AC/online");
else
snprintf(ac->state_file, MAX_NAME, PROC_ACPI "ac_adapter/%s/state", ac->name);
delete_list(lst);
read_acpi_acstate(globals);
return SUCCESS;
}
开发者ID:GiuseppeMassari,项目名称:libacpi,代码行数:27,代码来源:libacpi.c
示例4: main
int main() {
node* head = new node(0);
node* app = head;
for(int i = 0; i < 10; ++i) {
append(app, i);
app = app->next;
}
remove_duplicates(head);
node* curr = head;
while(curr) {
std::cout << curr->data << " ";
curr = curr->next;
}
std::cout << std::endl;
delete_list(head);
head = new node(0);
app = head;
for(int i = 0; i < 10; ++i) {
append(app, i);
app = app->next;
}
remove_dups_hash(head);
curr = head;
while(curr) {
std::cout << curr->data << " ";
curr = curr->next;
}
std::cout << std::endl;
delete_list(head);
}
开发者ID:robotxet,项目名称:intws,代码行数:31,代码来源:2_1_remove_duplicates.cpp
示例5: ConfigShutdown
m64p_error ConfigShutdown(void)
{
/* first, save the file if necessary */
if (l_SaveConfigOnExit)
ConfigSaveFile();
/* reset the initialized flag */
if (!l_ConfigInit)
return M64ERR_NOT_INIT;
l_ConfigInit = 0;
/* free any malloc'd local variables */
if (l_DataDirOverride != NULL)
{
free(l_DataDirOverride);
l_DataDirOverride = NULL;
}
if (l_ConfigDirOverride != NULL)
{
free(l_ConfigDirOverride);
l_ConfigDirOverride = NULL;
}
/* free all of the memory in the 2 lists */
delete_list(&l_ConfigListActive);
delete_list(&l_ConfigListSaved);
return M64ERR_SUCCESS;
}
开发者ID:adlr,项目名称:OpenEmu,代码行数:29,代码来源:config.c
示例6: test_exit
void test_exit(char *buffer, t_list *list)
{
char **tab;
tab = NULL;
if (buffer == NULL || buffer == 0)
{
free(buffer);
write(1, "exit\n", 5);
delete_list(&list);
exit(0);
}
tab = my_str_to_tab(buffer, ' ', 9);
if (tab[0] != NULL)
if (my_strcmp_exit(tab[0], "exit"))
{
if (!tab[1] || (tab[1] && !tab[2]))
{
delete_list(&list);
free(buffer);
write(1, "exit\n", 5);
free(tab);
exit(my_getnbr(tab[1]));
}
write(2, "exit: Expression Syntax.\n", 25);
}
free(tab);
}
开发者ID:plean,项目名称:PSU,代码行数:28,代码来源:test_builtins.c
示例7: request_clear
void request_clear(request_t* request)
{
list_t* n;
if (request->path)
free(request->path);
n = request->pathnodes;
while (n) {
free(n->data);
n = n->next;
}
delete_list(request->pathnodes);
n = request->args;
while (n) {
delete_pair((pair_t*)n->data);
n = n->next;
}
delete_list(request->args);
n = request->headers;
while (n) {
delete_pair((pair_t*)n->data);
n = n->next;
}
delete_list(request->headers);
if (request->body)
free(request->body);
memset(request, 0, sizeof(request_t));
}
开发者ID:hanappe,项目名称:opensensordata.net,代码行数:33,代码来源:server.c
示例8: lookup_flow_entry
flow_entry *
lookup_flow_entry( const uint8_t table_id, const match *match ) {
assert( valid_table_id( table_id ) || table_id == FLOW_TABLE_ALL );
if ( !lock_pipeline() ) {
return NULL;
}
// FIXME: allocating/freeing linked list elements may cost.
list_element *list = NULL;
if ( table_id != FLOW_TABLE_ALL ) {
list = lookup_flow_entries_with_table_id( table_id, match, 0, false, true );
}
else {
list = lookup_flow_entries_from_all_tables( match, 0, false, true );
}
if ( !unlock_pipeline() ) {
delete_list( list );
return NULL;
}
flow_entry *entry = NULL;
if ( list != NULL ) {
entry = list->data;
delete_list( list );
}
return entry;
}
开发者ID:kazuyas,项目名称:trema-edge,代码行数:31,代码来源:flow_table.c
示例9: stop_switch
static void
stop_switch() {
if ( switch_info.secure_channel_fd >= 0 ) {
close( switch_info.secure_channel_fd );
switch_info.secure_channel_fd = -1;
}
uint8_t state = MESSENGER_OPENFLOW_DISCONNECTED;
if ( switch_info.state == SWITCH_STATE_CONNECTION_FAILED ) {
state = MESSENGER_OPENFLOW_FAILD_TO_CONNECT;
}
service_send_state( &switch_info, &switch_info.datapath_id, state );
flush_messenger();
// free service name list
iterate_list( switch_info.vendor_service_name_list, xfree_data, NULL );
delete_list( switch_info.vendor_service_name_list );
switch_info.vendor_service_name_list = NULL;
iterate_list( switch_info.packetin_service_name_list, xfree_data, NULL );
delete_list( switch_info.packetin_service_name_list );
switch_info.packetin_service_name_list = NULL;
iterate_list( switch_info.portstatus_service_name_list, xfree_data, NULL );
delete_list( switch_info.portstatus_service_name_list );
switch_info.portstatus_service_name_list = NULL;
iterate_list( switch_info.state_service_name_list, xfree_data, NULL );
delete_list( switch_info.state_service_name_list );
switch_info.state_service_name_list = NULL;
stop_trema();
}
开发者ID:Milstein,项目名称:trema,代码行数:29,代码来源:switch.c
示例10: delete_list
const t_io *destroy_server_io(const t_io *io)
{
if (io)
{
delete_list(io->in, NULL);
delete_list(io->out, NULL);
}
return (NULL);
}
开发者ID:jlouazel,项目名称:zhappy,代码行数:9,代码来源:server_destroy_io.c
示例11: game_over
void game_over(Game *g) {
while(!key[KEY_ENTER])
if(key[KEY_ESC]) {
g->end = 1;
return;
}
delete_list(g->asteroids);
delete_list(g->shot);
delete_list(g->particles);
init_game(g);
}
开发者ID:ThomasWitte,项目名称:minigames,代码行数:12,代码来源:asteroids2.c
示例12: cleanup
void cleanup(node_data **data){
if ((*data)->neighbours)
delete_list(&(((*data)->neighbours)->head));
if ((*data)->neighbours_cost)
delete_list(&(((*data)->neighbours_cost)->head));
if ((*data)->messages)
delete_list(&(((*data)->messages)->head));
free(*data);
*data = NULL;
}
开发者ID:seylom,项目名称:routing_algorithms,代码行数:15,代码来源:protocol_helper.c
示例13: getAngles
PyObject* getAngles(PyObject *self, PyObject *args) {
/*
** Inputs:
** interger of search radius (in pixels)
** Modifies:
** nothing
** Outputs:
** 1D numpy array containing correlation values of angle (x-axis)
*/
Py_Initialize();
int radius;
if (!PyArg_ParseTuple(args, "i", &radius))
return NULL;
struct item *head = NULL;
head = getAnglesList(radius, head);
int numangles = list_length(head);
npy_intp outdims[1] = {numangles};
import_array(); // this is required to use PyArray_New() and PyArray_SimpleNew()
PyArrayObject *output;
output = (PyArrayObject *) PyArray_SimpleNew(1, outdims, NPY_DOUBLE);
struct item *current;
int i=0;
for(current=head; current!=NULL; current=current->next) {
*(double *) PyArray_GETPTR1(output, i) = current->angle;
i++;
}
delete_list(head);
return PyArray_Return(output);
}
开发者ID:kraftp,项目名称:Leginon-Feature-Detection-Modification,代码行数:34,代码来源:radon.c
示例14: delete_flow_entries_by_group_id
OFDPE
delete_flow_entries_by_group_id( const uint32_t group_id ) {
assert( valid_group_id( group_id ) );
if ( !lock_pipeline() ) {
return ERROR_LOCK;
}
list_element *delete_us = NULL;
create_list( &delete_us );
for ( uint8_t table_id = 0; table_id <= FLOW_TABLE_ID_MAX; table_id++ ) {
flow_table *table = get_flow_table( table_id );
assert( table != NULL );
for ( list_element *e = table->entries; e != NULL; e = e->next ) {
assert( e->data != NULL );
flow_entry *entry = e->data;
if ( instructions_have_output_group( entry->instructions, group_id ) ) {
append_to_tail( &delete_us, e->data );
}
}
}
delete_flow_entries_in_list( delete_us, 0, 0, OFPP_ANY, OFPG_ANY, OFPRR_GROUP_DELETE );
if ( delete_us != NULL ) {
delete_list( delete_us );
}
if ( !unlock_pipeline() ) {
return ERROR_UNLOCK;
}
return OFDPE_SUCCESS;
}
开发者ID:kazuyas,项目名称:trema-edge,代码行数:35,代码来源:flow_table.c
示例15: finalize_flow_table
OFDPE
finalize_flow_table( const uint8_t table_id ) {
if ( !valid_table_id( table_id ) ) {
error( "Invalid flow table id ( %#x ).", table_id );
return OFDPE_FAILED;
}
flow_table *table = get_flow_table( table_id );
if ( table == NULL ) {
return OFDPE_FAILED;
}
delete_timer_event_safe( age_flow_entries, &table->features.table_id );
for ( list_element *e = table->entries; e != NULL; e = e->next ) {
flow_entry *entry = e->data;
if ( entry != NULL ) {
free_flow_entry( entry );
}
}
delete_list( table->entries );
memset( table, 0, sizeof( flow_table ) );
table->initialized = false;
return OFDPE_SUCCESS;
}
开发者ID:kazuyas,项目名称:trema-edge,代码行数:27,代码来源:flow_table.c
示例16: update_face
int update_face(face *f, face_list *AFL) {
if (member_list(AFL, f)){
return delete_list(AFL, f);
}
else
return insert_list(AFL, f);
}
开发者ID:Clover27,项目名称:dewall-omp,代码行数:7,代码来源:simplex.c
示例17: main
int main(int argc ,char** argv)
{
int a[20]= {1,2,3,4,5,6,7,8,9,10,11,12,13};
int i=0;
list L;
L = init_list();
print(L);
printf("insert node\n");
for(i=0;i<13;i++)
{
insert_node( L,a[i]);
}
print( L);
position mid = GetMidEle(L);
printf("mid elemenet is %d \n",mid->data);
printf("delete node\n");
position P;
P = find_value( L, 5);
delete_node( L,P);
print( L);
printf("find node and insert node\n");
P = find_value( L, 2);
insert_node( P,111);
print( L);
delete_list( L);
print( L);
}
开发者ID:xiabodan,项目名称:WrittenQuestions,代码行数:32,代码来源:xiabodan_list.c
示例18: delete_file
int delete_file(union directory_entry *file_ptr, unsigned int directory_clus, unsigned int entry_num) {
union directory_entry next_file;
struct list *clusters;
struct node *clus_node;
unsigned int file_clus;
clusters = create_list();
file_clus = get_file_cluster(file_ptr);
do {
clusters->add(clusters, file_clus, "r");
file_clus = get_next_cluster_in_fat(file_clus);
} while (!end_of_chain(file_clus));
while (!clusters->empty(clusters)) {
clus_node = clusters->get_head(clusters);
delete_cluster(clus_node->fst_file_clus);
clusters->remove(clusters, clus_node->fst_file_clus);
}
get_next_directory_entry(&next_file, directory_clus, entry_num);
if (next_file.raw_bytes[0] == 0x00) {
file_ptr->raw_bytes[0] = 0x00;
} else {
file_ptr->raw_bytes[0] = 0xE5;
}
delete_list(clusters);
set_directory_entry(file_ptr, directory_clus, entry_num);
return 1;
}
开发者ID:cop4610t-cool-group,项目名称:project3,代码行数:28,代码来源:file_types.c
示例19: delete_list
void delete_list(struct Entry *temp)
{
if (temp != NULL) {
delete_list(temp->next);
free(temp);
}
}
开发者ID:Jared-Adamson,项目名称:CSE-C-Cpp-LISP-Prolog-Programs,代码行数:7,代码来源:GradeBook.c
示例20: thread_suspend
err_t thread_suspend(tid_t tid)
{
cpu_sr_t cpu_sr;
thread_struct *pthread;
if (tid < IDLE_THREAD_TID || tid > MAX_THREAD)
return RET_ERR;
if (thread_table[tid] == NULL)
return RET_ERR;
cpu_sr = save_cpu_sr();
pthread = thread_table[tid];
if (current_thread->tid == tid) {
pthread->state = BLOCK;
insert_back_list(&blocked_list, &pthread->node);
restore_cpu_sr(cpu_sr);
schedule(SCHED_THREAD_REQUEST);
return RET_NO_ERR;
}
else if (pthread->prio > current_thread->prio &&
pthread->state == READY) {
pthread->state = BLOCK;
delete_list(&pthread->node);
insert_back_list(&blocked_list, &pthread->node);
restore_cpu_sr(cpu_sr);
schedule(SCHED_THREAD_REQUEST);
return RET_NO_ERR;
}
restore_cpu_sr(cpu_sr);
return RET_ERR;
}
开发者ID:Rafe,项目名称:CuRT,代码行数:32,代码来源:thread.c
注:本文中的delete_list函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论