From 0520d715c35839028d8cd30a8474e5d2c2c72661 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 25 Feb 2020 20:44:43 +0100 Subject: [PATCH] Expr: don't pass reference to pointer to check_and_promote*() The function never modifies the pointer value. check_and_promote_expr() is left untouched because it really does modify the pointer. --- src/Expr.cc | 6 +++--- src/Expr.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Expr.cc b/src/Expr.cc index fb2583fc6c..1ee6bd16ba 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -5195,7 +5195,7 @@ int check_and_promote_expr(Expr*& e, BroType* t) return 1; } -int check_and_promote_exprs(ListExpr*& elements, TypeList* types) +int check_and_promote_exprs(ListExpr*const elements, TypeList* types) { expr_list& el = elements->Exprs(); const type_list* tl = types->Types(); @@ -5225,7 +5225,7 @@ int check_and_promote_exprs(ListExpr*& elements, TypeList* types) return 1; } -int check_and_promote_args(ListExpr*& args, RecordType* types) +int check_and_promote_args(ListExpr*const args, RecordType* types) { expr_list& el = args->Exprs(); int ntypes = types->NumFields(); @@ -5269,7 +5269,7 @@ int check_and_promote_args(ListExpr*& args, RecordType* types) return rval; } -int check_and_promote_exprs_to_type(ListExpr*& elements, BroType* type) +int check_and_promote_exprs_to_type(ListExpr*const elements, BroType* type) { expr_list& el = elements->Exprs(); diff --git a/src/Expr.h b/src/Expr.h index 701e826b19..1dce2d8370 100644 --- a/src/Expr.h +++ b/src/Expr.h @@ -1085,9 +1085,9 @@ Expr* get_assign_expr(Expr* op1, Expr* op2, int is_init); // // Note, the type is not "const" because it can be ref'd. extern int check_and_promote_expr(Expr*& e, BroType* t); -extern int check_and_promote_exprs(ListExpr*& elements, TypeList* types); -extern int check_and_promote_args(ListExpr*& args, RecordType* types); -extern int check_and_promote_exprs_to_type(ListExpr*& elements, BroType* type); +extern int check_and_promote_exprs(ListExpr* elements, TypeList* types); +extern int check_and_promote_args(ListExpr* args, RecordType* types); +extern int check_and_promote_exprs_to_type(ListExpr* elements, BroType* type); // Returns a ListExpr simplified down to a list a values, or a nil // pointer if they couldn't all be reduced.