int main() { fn(); node* list = NULL; insertAtStart(&list,2); insertAtStart(&list,3); insertAtStart(&list,4); insertAtStart(&list,5); traverseForward(list); deleteFirst(&list); traverseForward(list); return 0; }
static aclList parsePermissions(xmlNode *node, aclList policyList) { xmlNode *cur_node = node; policyPtr accessNode = null; if (cur_node && cur_node->type == XML_ELEMENT_NODE && !strcmp(cur_node->name, permissionsTagName)) { for (cur_node = node->children; cur_node; cur_node = cur_node->next) { if (cur_node->type == XML_ELEMENT_NODE) { if (!strcmp(cur_node->name, allowTagName)) { accessNode = parsePermission(cur_node, 1); if (accessNode) { insertAtBack(policyList, accessNode); } else { return null; } } else if (!strcmp(cur_node->name, denyTagName)) { accessNode = parsePermission(cur_node, 0); if (accessNode) { insertAtStart(policyList, accessNode); } else { return null; } } else { fprintf(stderr, "\nInvalid Element:%s\n", cur_node->name); } } } } else { fprintf(stderr, "Expected element : %s, as root node but found:%s", permissionsTagName, cur_node->name); } return policyList; }
int insertProcess(Queue *queue, P *process){ P *prev, *next,*ver; int i = 0; ver = queue->head; if(queue->size == 0) return insertAtStart(queue, process); if(process->p_priority < ver->p_priority) return insertAtStart(queue, process); for(ver = 0;ver->next != '\0';ver = ver->next){ prev = ver; next = ver->next; if(process->p_priority < next->p_priority) return insertProcess1(queue ,prev, process ,next); }; ver->next = process; process->next = '\0'; ++queue->size; return queue->size; }
int main() { int i, key; srand(time(NULL)); printf("Keys: "); for(i=0; i<10; i++) { key = rand()%20; printf("%d ", key); insertAtStart(&HEAD, key); } printf("\n"); walk(HEAD); deleteNode(&HEAD, key); walk(HEAD); return 0; }