Want to make use of selinux_sid_to_str[] and xen_sid_to_str[] from
kernel_to_common.h in module_to_cil.c, but stack functions with the
same names exist in module_to_cil.c and kernel_to_common.c (with
the function prototypes in kernel_to_common.h).

Since the stack functions in kernel_to_common.c are less general and
only work with strings, rename those functions from stack_* to
strs_stack_*.

Signed-off-by: James Carter <[email protected]>
---
 libsepol/src/kernel_to_cil.c    | 36 ++++++++++++++++-----------------
 libsepol/src/kernel_to_common.c | 10 ++++-----
 libsepol/src/kernel_to_common.h | 10 ++++-----
 libsepol/src/kernel_to_conf.c   | 36 ++++++++++++++++-----------------
 4 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/libsepol/src/kernel_to_cil.c b/libsepol/src/kernel_to_cil.c
index b1eb66d6..c2a733ee 100644
--- a/libsepol/src/kernel_to_cil.c
+++ b/libsepol/src/kernel_to_cil.c
@@ -36,7 +36,7 @@ static char *cond_expr_to_str(struct policydb *pdb, struct 
cond_expr *expr)
        char *str = NULL;
        int rc;
 
-       rc = stack_init(&stack);
+       rc = strs_stack_init(&stack);
        if (rc != 0) {
                goto exit;
        }
@@ -65,13 +65,13 @@ static char *cond_expr_to_str(struct policydb *pdb, struct 
cond_expr *expr)
                        }
 
                        if (num_params == 2) {
-                               val2 = stack_pop(stack);
+                               val2 = strs_stack_pop(stack);
                                if (!val2) {
                                        sepol_log_err("Invalid conditional 
expression");
                                        goto exit;
                                }
                        }
-                       val1 = stack_pop(stack);
+                       val1 = strs_stack_pop(stack);
                        if (!val1) {
                                sepol_log_err("Invalid conditional expression");
                                free(val2);
@@ -89,29 +89,29 @@ static char *cond_expr_to_str(struct policydb *pdb, struct 
cond_expr *expr)
                        sepol_log_err("Invalid conditional expression");
                        goto exit;
                }
-               rc = stack_push(stack, new_val);
+               rc = strs_stack_push(stack, new_val);
                if (rc != 0) {
                        sepol_log_err("Out of memory");
                        goto exit;
                }
        }
 
-       new_val = stack_pop(stack);
-       if (!new_val || !stack_empty(stack)) {
+       new_val = strs_stack_pop(stack);
+       if (!new_val || !strs_stack_empty(stack)) {
                sepol_log_err("Invalid conditional expression");
                goto exit;
        }
 
        str = new_val;
 
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
        return str;
 
 exit:
-       while ((new_val = stack_pop(stack)) != NULL) {
+       while ((new_val = strs_stack_pop(stack)) != NULL) {
                free(new_val);
        }
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
 
        return NULL;
 }
@@ -127,7 +127,7 @@ static char *constraint_expr_to_str(struct policydb *pdb, 
struct constraint_expr
 
        *use_mls = 0;
 
-       rc = stack_init(&stack);
+       rc = strs_stack_init(&stack);
        if (rc != 0) {
                goto exit;
        }
@@ -208,13 +208,13 @@ static char *constraint_expr_to_str(struct policydb *pdb, 
struct constraint_expr
                        }
 
                        if (num_params == 2) {
-                               val2 = stack_pop(stack);
+                               val2 = strs_stack_pop(stack);
                                if (!val2) {
                                        sepol_log_err("Invalid constraint 
expression");
                                        goto exit;
                                }
                        }
-                       val1 = stack_pop(stack);
+                       val1 = strs_stack_pop(stack);
                        if (!val1) {
                                sepol_log_err("Invalid constraint expression");
                                goto exit;
@@ -231,30 +231,30 @@ static char *constraint_expr_to_str(struct policydb *pdb, 
struct constraint_expr
                if (!new_val) {
                        goto exit;
                }
-               rc = stack_push(stack, new_val);
+               rc = strs_stack_push(stack, new_val);
                if (rc != 0) {
                        sepol_log_err("Out of memory");
                        goto exit;
                }
        }
 
-       new_val = stack_pop(stack);
-       if (!new_val || !stack_empty(stack)) {
+       new_val = strs_stack_pop(stack);
+       if (!new_val || !strs_stack_empty(stack)) {
                sepol_log_err("Invalid constraint expression");
                goto exit;
        }
 
        str = new_val;
 
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
 
        return str;
 
 exit:
-       while ((new_val = stack_pop(stack)) != NULL) {
+       while ((new_val = strs_stack_pop(stack)) != NULL) {
                free(new_val);
        }
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
 
        return NULL;
 }
diff --git a/libsepol/src/kernel_to_common.c b/libsepol/src/kernel_to_common.c
index 7c5699c5..891e139c 100644
--- a/libsepol/src/kernel_to_common.c
+++ b/libsepol/src/kernel_to_common.c
@@ -400,27 +400,27 @@ exit:
        return str;
 }
 
-int stack_init(struct strs **stack)
+int strs_stack_init(struct strs **stack)
 {
        return strs_init(stack, STACK_SIZE);
 }
 
-void stack_destroy(struct strs **stack)
+void strs_stack_destroy(struct strs **stack)
 {
        return strs_destroy(stack);
 }
 
-int stack_push(struct strs *stack, char *s)
+int strs_stack_push(struct strs *stack, char *s)
 {
        return strs_add(stack, s);
 }
 
-char *stack_pop(struct strs *stack)
+char *strs_stack_pop(struct strs *stack)
 {
        return strs_remove_last(stack);
 }
 
-int stack_empty(struct strs *stack)
+int strs_stack_empty(struct strs *stack)
 {
        return strs_num_items(stack) == 0;
 }
diff --git a/libsepol/src/kernel_to_common.h b/libsepol/src/kernel_to_common.h
index 992929ae..7c5edbd6 100644
--- a/libsepol/src/kernel_to_common.h
+++ b/libsepol/src/kernel_to_common.h
@@ -105,10 +105,10 @@ int hashtab_ordered_to_strs(char *key, void *data, void 
*args);
 int ebitmap_to_strs(struct ebitmap *map, struct strs *strs, char 
**val_to_name);
 char *ebitmap_to_str(struct ebitmap *map, char **val_to_name, int sort);
 
-int stack_init(struct strs **stack);
-void stack_destroy(struct strs **stack);
-int stack_push(struct strs *stack, char *s);
-char *stack_pop(struct strs *stack);
-int stack_empty(struct strs *stack);
+int strs_stack_init(struct strs **stack);
+void strs_stack_destroy(struct strs **stack);
+int strs_stack_push(struct strs *stack, char *s);
+char *strs_stack_pop(struct strs *stack);
+int strs_stack_empty(struct strs *stack);
 
 int sort_ocontexts(struct policydb *pdb);
diff --git a/libsepol/src/kernel_to_conf.c b/libsepol/src/kernel_to_conf.c
index 95405207..a98b5ca9 100644
--- a/libsepol/src/kernel_to_conf.c
+++ b/libsepol/src/kernel_to_conf.c
@@ -35,7 +35,7 @@ static char *cond_expr_to_str(struct policydb *pdb, struct 
cond_expr *expr)
        char *str = NULL;
        int rc;
 
-       rc = stack_init(&stack);
+       rc = strs_stack_init(&stack);
        if (rc != 0) {
                goto exit;
        }
@@ -63,13 +63,13 @@ static char *cond_expr_to_str(struct policydb *pdb, struct 
cond_expr *expr)
                        }
 
                        if (num_params == 2) {
-                               val2 = stack_pop(stack);
+                               val2 = strs_stack_pop(stack);
                                if (!val2) {
                                        sepol_log_err("Invalid conditional 
expression");
                                        goto exit;
                                }
                        }
-                       val1 = stack_pop(stack);
+                       val1 = strs_stack_pop(stack);
                        if (!val1) {
                                sepol_log_err("Invalid conditional expression");
                                free(val2);
@@ -87,29 +87,29 @@ static char *cond_expr_to_str(struct policydb *pdb, struct 
cond_expr *expr)
                        sepol_log_err("Invalid conditional expression");
                        goto exit;
                }
-               rc = stack_push(stack, new_val);
+               rc = strs_stack_push(stack, new_val);
                if (rc != 0) {
                        sepol_log_err("Out of memory");
                        goto exit;
                }
        }
 
-       new_val = stack_pop(stack);
-       if (!new_val || !stack_empty(stack)) {
+       new_val = strs_stack_pop(stack);
+       if (!new_val || !strs_stack_empty(stack)) {
                sepol_log_err("Invalid conditional expression");
                goto exit;
        }
 
        str = new_val;
 
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
        return str;
 
 exit:
-       while ((new_val = stack_pop(stack)) != NULL) {
+       while ((new_val = strs_stack_pop(stack)) != NULL) {
                free(new_val);
        }
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
 
        return NULL;
 }
@@ -125,7 +125,7 @@ static char *constraint_expr_to_str(struct policydb *pdb, 
struct constraint_expr
 
        *use_mls = 0;
 
-       rc = stack_init(&stack);
+       rc = strs_stack_init(&stack);
        if (rc != 0) {
                goto exit;
        }
@@ -204,13 +204,13 @@ static char *constraint_expr_to_str(struct policydb *pdb, 
struct constraint_expr
                        }
 
                        if (num_params == 2) {
-                               val2 = stack_pop(stack);
+                               val2 = strs_stack_pop(stack);
                                if (!val2) {
                                        sepol_log_err("Invalid constraint 
expression");
                                        goto exit;
                                }
                        }
-                       val1 = stack_pop(stack);
+                       val1 = strs_stack_pop(stack);
                        if (!val1) {
                                sepol_log_err("Invalid constraint expression");
                                goto exit;
@@ -227,30 +227,30 @@ static char *constraint_expr_to_str(struct policydb *pdb, 
struct constraint_expr
                if (!new_val) {
                        goto exit;
                }
-               rc = stack_push(stack, new_val);
+               rc = strs_stack_push(stack, new_val);
                if (rc != 0) {
                        sepol_log_err("Out of memory");
                        goto exit;
                }
        }
 
-       new_val = stack_pop(stack);
-       if (!new_val || !stack_empty(stack)) {
+       new_val = strs_stack_pop(stack);
+       if (!new_val || !strs_stack_empty(stack)) {
                sepol_log_err("Invalid constraint expression");
                goto exit;
        }
 
        str = new_val;
 
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
 
        return str;
 
 exit:
-       while ((new_val = stack_pop(stack)) != NULL) {
+       while ((new_val = strs_stack_pop(stack)) != NULL) {
                free(new_val);
        }
-       stack_destroy(&stack);
+       strs_stack_destroy(&stack);
 
        return NULL;
 }
-- 
2.17.1

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Reply via email to