Skip to content

Commit 4887dce

Browse files
kkysenRua
andcommitted
transpile: reverse args in null_pointer_case
Co-authored-by: Rua <ruawhitepaw@gmail.com>
1 parent edadca1 commit 4887dce

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • c2rust-transpile/src/translator

c2rust-transpile/src/translator/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,7 +2715,7 @@ impl<'c> Translation<'c> {
27152715
.ok_or_else(|| format_err!("bad condition type"))?;
27162716

27172717
let null_pointer_case =
2718-
|is_null: bool, ptr: CExprId| -> TranslationResult<WithStmts<Box<Expr>>> {
2718+
|ptr: CExprId, is_null: bool| -> TranslationResult<WithStmts<Box<Expr>>> {
27192719
let val = self.convert_expr(ctx.used().decay_ref(), ptr, None)?;
27202720
let ptr_type = self.ast_context[ptr]
27212721
.kind
@@ -2729,25 +2729,25 @@ impl<'c> Translation<'c> {
27292729
CExprKind::Binary(_, c_ast::BinOp::EqualEqual, null_expr, ptr, _, _)
27302730
if self.ast_context.is_null_expr(null_expr) =>
27312731
{
2732-
null_pointer_case(target, ptr)
2732+
null_pointer_case(ptr, target)
27332733
}
27342734

27352735
CExprKind::Binary(_, c_ast::BinOp::EqualEqual, ptr, null_expr, _, _)
27362736
if self.ast_context.is_null_expr(null_expr) =>
27372737
{
2738-
null_pointer_case(target, ptr)
2738+
null_pointer_case(ptr, target)
27392739
}
27402740

27412741
CExprKind::Binary(_, c_ast::BinOp::NotEqual, null_expr, ptr, _, _)
27422742
if self.ast_context.is_null_expr(null_expr) =>
27432743
{
2744-
null_pointer_case(!target, ptr)
2744+
null_pointer_case(ptr, !target)
27452745
}
27462746

27472747
CExprKind::Binary(_, c_ast::BinOp::NotEqual, ptr, null_expr, _, _)
27482748
if self.ast_context.is_null_expr(null_expr) =>
27492749
{
2750-
null_pointer_case(!target, ptr)
2750+
null_pointer_case(ptr, !target)
27512751
}
27522752

27532753
CExprKind::Unary(_, c_ast::UnOp::Not, subexpr_id, _) => {

0 commit comments

Comments
 (0)