c59879b8aa
Rebase on upstream commit 32611aea6543 See $ cd SELinuxProject/selinux $ git log --pretty=oneline libsepol-3.2..32611aea6543 -- libsepol
92 lines
2.7 KiB
Diff
92 lines
2.7 KiB
Diff
From f043078f1debeb1c84d4f6943aa689c33dd9cefc Mon Sep 17 00:00:00 2001
|
|
From: James Carter <jwcart2@gmail.com>
|
|
Date: Tue, 30 Mar 2021 13:39:13 -0400
|
|
Subject: [PATCH] libsepol/cil: Cleanup build AST helper functions
|
|
|
|
Since parse_current, finished, and extra_args can never be NULL,
|
|
remove the useless check and directly assign local variables from
|
|
extra_args.
|
|
|
|
Signed-off-by: James Carter <jwcart2@gmail.com>
|
|
---
|
|
libsepol/cil/src/cil_build_ast.c | 44 ++++++++------------------------
|
|
1 file changed, 10 insertions(+), 34 deletions(-)
|
|
|
|
diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
|
|
index eee21086bba8..0d6d91a7dc34 100644
|
|
--- a/libsepol/cil/src/cil_build_ast.c
|
|
+++ b/libsepol/cil/src/cil_build_ast.c
|
|
@@ -6065,28 +6065,16 @@ void cil_destroy_src_info(struct cil_src_info *info)
|
|
|
|
int __cil_build_ast_node_helper(struct cil_tree_node *parse_current, uint32_t *finished, void *extra_args)
|
|
{
|
|
- struct cil_args_build *args = NULL;
|
|
- struct cil_tree_node *ast_current = NULL;
|
|
- struct cil_db *db = NULL;
|
|
+ struct cil_args_build *args = extra_args;
|
|
+ struct cil_db *db = args->db;
|
|
+ struct cil_tree_node *ast_current = args->ast;
|
|
+ struct cil_tree_node *tunif = args->tunif;
|
|
+ struct cil_tree_node *in = args->in;
|
|
+ struct cil_tree_node *macro = args->macro;
|
|
+ struct cil_tree_node *boolif = args->boolif;
|
|
struct cil_tree_node *ast_node = NULL;
|
|
- struct cil_tree_node *tunif = NULL;
|
|
- struct cil_tree_node *in = NULL;
|
|
- struct cil_tree_node *macro = NULL;
|
|
- struct cil_tree_node *boolif = NULL;
|
|
int rc = SEPOL_ERR;
|
|
|
|
- if (parse_current == NULL || finished == NULL || extra_args == NULL) {
|
|
- goto exit;
|
|
- }
|
|
-
|
|
- args = extra_args;
|
|
- ast_current = args->ast;
|
|
- db = args->db;
|
|
- tunif = args->tunif;
|
|
- in = args->in;
|
|
- macro = args->macro;
|
|
- boolif = args->boolif;
|
|
-
|
|
if (parse_current->parent->cl_head != parse_current) {
|
|
/* ignore anything that isn't following a parenthesis */
|
|
rc = SEPOL_OK;
|
|
@@ -6474,20 +6462,11 @@ exit:
|
|
|
|
int __cil_build_ast_last_child_helper(struct cil_tree_node *parse_current, void *extra_args)
|
|
{
|
|
- int rc = SEPOL_ERR;
|
|
- struct cil_tree_node *ast = NULL;
|
|
- struct cil_args_build *args = NULL;
|
|
-
|
|
- if (extra_args == NULL) {
|
|
- goto exit;
|
|
- }
|
|
-
|
|
- args = extra_args;
|
|
- ast = args->ast;
|
|
+ struct cil_args_build *args = extra_args;
|
|
+ struct cil_tree_node *ast = args->ast;
|
|
|
|
if (ast->flavor == CIL_ROOT) {
|
|
- rc = SEPOL_OK;
|
|
- goto exit;
|
|
+ return SEPOL_OK;
|
|
}
|
|
|
|
args->ast = ast->parent;
|
|
@@ -6516,9 +6495,6 @@ int __cil_build_ast_last_child_helper(struct cil_tree_node *parse_current, void
|
|
cil_tree_children_destroy(parse_current->parent);
|
|
|
|
return SEPOL_OK;
|
|
-
|
|
-exit:
|
|
- return rc;
|
|
}
|
|
|
|
int cil_build_ast(struct cil_db *db, struct cil_tree_node *parse_tree, struct cil_tree_node *ast)
|
|
--
|
|
2.32.0
|
|
|