Lines Matching defs:stack

165 	struct stack *decl_stack;
171 struct stack {
172 void **stack;
414 static int stack_destroy(struct stack **stack)
416 if (stack == NULL || *stack == NULL) {
420 free((*stack)->stack);
421 free(*stack);
422 *stack = NULL;
427 static int stack_init(struct stack **stack)
430 struct stack *s = calloc(1, sizeof(*s));
435 s->stack = calloc(STACK_SIZE, sizeof(*s->stack));
436 if (s->stack == NULL) {
443 *stack = s;
452 static int stack_push(struct stack *stack, void *ptr)
457 if (stack->pos + 1 == stack->size) {
458 new_stack = reallocarray(stack->stack, stack->size * 2, sizeof(*stack->stack));
462 stack->stack = new_stack;
463 stack->size *= 2;
466 stack->pos++;
467 stack->stack[stack->pos] = ptr;
474 static void *stack_pop(struct stack *stack)
476 if (stack->pos == -1) {
480 stack->pos--;
481 return stack->stack[stack->pos + 1];
484 static void *stack_peek(struct stack *stack)
486 if (stack->pos == -1) {
490 return stack->stack[stack->pos];
493 static int is_id_in_scope_with_start(struct policydb *pdb, struct stack *decl_stack, int start, uint32_t symbol_type, char *id)
506 decl = decl_stack->stack[i];
518 static int is_id_in_ancestor_scope(struct policydb *pdb, struct stack *decl_stack, char *type, uint32_t symbol_type)
525 static int is_id_in_scope(struct policydb *pdb, struct stack *decl_stack, char *type, uint32_t symbol_type)
1086 static int roletype_role_in_ancestor_to_cil(struct policydb *pdb, struct stack *decl_stack, char *type_name, int indent)
1256 struct stack *stack = NULL;
1267 rc = stack_init(&stack);
1306 val1 = stack_pop(stack);
1315 val2 = stack_pop(stack);
1316 val1 = stack_pop(stack);
1352 rc = stack_push(stack, new_val);
1366 val1 = stack_pop(stack);
1367 if (val1 == NULL || stack_peek(stack) != NULL) {
1383 if (stack != NULL) {
1384 while ((val1 = stack_pop(stack)) != NULL) {
1387 stack_destroy(&stack);
1712 struct stack *stack = NULL;
1728 rc = stack_init(&stack);
1855 val1 = stack_pop(stack);
1864 val2 = stack_pop(stack);
1865 val1 = stack_pop(stack);
1901 rc = stack_push(stack, new_val);
1910 new_val = stack_pop(stack);
1911 if (new_val == NULL || stack_peek(stack) != NULL) {
1929 if (stack != NULL) {
1930 while ((val1 = stack_pop(stack)) != NULL) {
1933 stack_destroy(&stack);
1975 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)
2106 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)
2238 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)
2311 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)
2362 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)
2380 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)
2424 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)
3376 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) = {
3387 static int typealiases_to_cil(int indent, struct policydb *pdb, struct avrule_block *UNUSED(block), struct stack *decl_stack)
3428 static int declared_scopes_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack)
3491 static int required_scopes_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack)
3568 static int additive_scopes_to_cil(int indent, struct policydb *pdb, struct avrule_block *block, struct stack *decl_stack)
3641 static int block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack, int indent)
3659 rc = typealiases_to_cil(indent, pdb, block, stack);
3664 rc = declared_scopes_to_cil(indent, pdb, block, stack);
3669 rc = required_scopes_to_cil(indent, pdb, block, stack);
3674 rc = additive_scopes_to_cil(indent, pdb, block, stack);
3725 static int module_block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack, int *indent)
3741 while (stack->pos > 0) {
3742 decl_tmp = stack_peek(stack);
3747 stack_pop(stack);
3756 stack_push(stack, decl);
3758 rc = block_to_cil(pdb, block, stack, *indent);
3767 static int global_block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack)
3781 stack_push(stack, decl);
3791 rc = block_to_cil(pdb, block, stack, 0);
3805 struct stack *stack = NULL;
3807 rc = stack_init(&stack);
3813 rc = global_block_to_cil(pdb, block, stack);
3819 rc = module_block_to_cil(pdb, block, stack, &indent);
3831 stack_destroy(&stack);
3836 static int linked_block_to_cil(struct policydb *pdb, struct avrule_block *block, struct stack *stack)
3854 stack_push(stack, decl);
3856 rc = block_to_cil(pdb, block, stack, 0);
3861 stack_pop(stack);
3873 struct stack *stack = NULL;
3875 rc = stack_init(&stack);
3881 rc = global_block_to_cil(pdb, block, stack);
3887 rc = linked_block_to_cil(pdb, block, stack);
3894 stack_destroy(&stack);