hab-remove-node.c
来自「MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis」· C语言 代码 · 共 64 行
C
64 行
#include <string.h>#include <glib.h>#include "bionet-util.h"int bionet_hab_remove_all_nodes(bionet_hab_t *hab) { if (hab == NULL) { g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_hab_remove_all_nodes(): NULL HAB passed in"); return -1; } // remove all of this HAB's Nodes do { bionet_node_t *node; node = g_slist_nth_data(hab->nodes, 0); if (node == NULL) break; // done hab->nodes = g_slist_remove(hab->nodes, node); bionet_node_free(node); } while(1); return 0;}int bionet_hab_remove_node_by_id(bionet_hab_t *hab, const char *node_id) { bionet_node_t *node; if (hab == NULL) { g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_hab_remove_node_by_id(): NULL HAB passed in"); return -1; } if (node_id == NULL) { g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_hab_remove_node_by_id(): NULL node_id passed in"); return -1; } node = bionet_hab_get_node_by_id(hab, node_id); if (node == NULL) { g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "bionet_hab_remove_node_by_id(): Node '%s' not found", node_id); return -1; } hab->nodes = g_slist_remove(hab->nodes, node); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?