Home | History | Annotate | Download | only in src

Lines Matching refs:stack

164 	struct stack *decl_stack;
170 struct stack {
171 void **stack;
409 static int stack_destroy(struct stack **stack)
411 if (stack == NULL || *stack == NULL) {
415 free((*stack)->stack);
416 free(*stack);
417 *stack = NULL;
422 static int stack_init(struct stack **stack)
425 struct stack *s = calloc(1, sizeof(*s));
430 s->stack = malloc(sizeof(*s->stack) * STACK_SIZE);
431 if (s->stack == NULL) {
438 *stack = s;
447 static int stack_push(struct stack *stack, void *ptr)
452 if (stack->pos + 1 == stack->size) {
453 new_stack = realloc(stack->stack, sizeof(*stack->stack) * (stack->size * 2));
457 stack->stack = new_stack;
458 stack->size *= 2;
461 stack->pos++;
462 stack->stack[stack->pos] = ptr;
469 static void *stack_pop(struct stack *stack)
471 if (stack->pos == -1) {
475 stack->pos--;
476 return stack->stack[stack->pos + 1];
479 static void *stack_peek(struct stack *stack)
481 if (stack->pos == -1) {
485 return stack->stack[stack->pos];
488 static int is_id_in_scope_with_start(struct policydb *pdb, struct stack *decl_stack, int start, uint32_t symbol_type, char *id)
501 decl = decl_stack->stack[i];
513 static int is_id_in_ancestor_scope(struct policydb *pdb, struct stack *decl_stack, char *type, uint32_t symbol_type)
520 static int is_id_in_scope(struct policydb *pdb, struct stack *decl_stack, char *type, uint32_t symbol_type)
1094 static int roletype_role_in_ancestor_to_cil(struct policydb *pdb, struct stack *decl_stack, char *type_name, int indent)
1266 struct stack *stack = NULL;
1277 rc = stack_init(&stack);
1316 val1 = stack_pop(stack);
1325 val2 = stack_pop(stack);
1326 val1 = stack_pop(stack);
1365 rc = stack_push(stack, new_val);
1379 val1 = stack_pop(stack);
1380 if (val1 == NULL || stack_peek(stack) != NULL) {
1396 if (stack != NULL) {
1397 while ((val1 = stack_pop(stack)) != NULL) {
1400 stack_destroy(&stack);
1725 struct stack *stack = NULL;
1741 rc = stack_init(&stack);
1853 val1 = stack_pop(stack);
1862 val2 = stack_pop(stack);
1863 val1 = stack_pop(stack);
1902 rc = stack_push(stack, new_val);
1911 new_val = stack_pop(stack);
1912 if (new_val == NULL || stack_peek(stack) != NULL) {
1930 if (stack != NULL) {
1931 while ((val1 = stack_pop(stack)) != NULL) {
1934 stack_destroy(&stack);
1976 static int class_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *UNUSED(decl_stack), char *key, void *datum, int scope)
2109 static int role_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *decl_stack, char *key, void *datum, int scope)
2244 static int type_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *decl_stack, char *key, void *datum, int scope)
2317 static int user_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *UNUSED(decl_stack), char *key, void *datum, int scope)
2371 static int boolean_to_cil(int indent, struct policydb *UNUSED(pdb), struct avrule_block *UNUSED(block), struct stack *UNUSED(decl_stack), char *key, void *datum, int scope)
2389 static int sens_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *UNUSED(decl_stack), char *key, void *datum, int scope)
2436 static int cat_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *UNUSED(decl_stack), char *key, void *datum, int scope)
3365 static int (*func_to_cil[SYM_NUM])(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack, char *key, void *datum, int scope) = {
3376 static int typealiases_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *decl_stack)
3412 static int declared_scopes_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack)
3478 static int required_scopes_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack)
3558 static int additive_scopes_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack)
3631 static int block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack, int indent)
3649 rc = typealiases_to_cil(indent, pdb, block, stack);
3654 rc = declared_scopes_to_cil(indent, pdb, block, stack);
3659 rc = required_scopes_to_cil(indent, pdb, block, stack);
3664 rc = additive_scopes_to_cil(indent, pdb, block, stack);
3715 static int module_block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack, int *indent)
3731 while (stack->pos > 0) {
3732 decl_tmp = stack_peek(stack);
3737 stack_pop(stack);
3746 stack_push(stack, decl);
3748 rc = block_to_cil(pdb, block, stack, *indent);
3757 static int global_block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack)
3771 stack_push(stack, decl);
3781 rc = block_to_cil(pdb, block, stack, 0);
3795 struct stack *stack = NULL;
3797 rc = stack_init(&stack);
3803 rc = global_block_to_cil(pdb, block, stack);
3809 rc = module_block_to_cil(pdb, block, stack, &indent);
3821 stack_destroy(&stack);
3826 static int linked_block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack)
3844 stack_push(stack, decl);
3846 rc = block_to_cil(pdb, block, stack, 0);
3851 stack_pop(stack);
3863 struct stack *stack = NULL;
3865 rc = stack_init(&stack);
3871 rc = global_block_to_cil(pdb, block, stack);
3877 rc = linked_block_to_cil(pdb, block, stack);
3884 stack_destroy(&stack);