Author: markj
Date: Tue Feb  4 21:14:34 2020
New Revision: 357531
URL: https://svnweb.freebsd.org/changeset/base/357531

Log:
  libdwarf: Remove unnecessary NULL checks.
  
  All callers of _dwarf_add_expr() and _dwarf_expr_into_block() pass a
  non-NULL expr pointer, and these functions assume that expr is non-NULL
  anyway.
  
  CID:          1193305, 1193306
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c

Modified: head/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c Tue Feb  4 21:02:08 
2020        (r357530)
+++ head/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c Tue Feb  4 21:14:34 
2020        (r357531)
@@ -36,10 +36,10 @@ _dwarf_add_expr(Dwarf_P_Expr expr, Dwarf_Small opcode,
        Dwarf_Debug dbg;
        int len;
 
-       dbg = expr != NULL ? expr->pe_dbg : NULL;
+       dbg = expr->pe_dbg;
 
-       if (_dwarf_loc_expr_add_atom(expr->pe_dbg, NULL, NULL, opcode, val1,
-           val2, &len, error) != DW_DLE_NONE)
+       if (_dwarf_loc_expr_add_atom(dbg, NULL, NULL, opcode, val1, val2, &len,
+           error) != DW_DLE_NONE)
                return (NULL);
        assert(len > 0);
 
@@ -67,7 +67,7 @@ _dwarf_expr_into_block(Dwarf_P_Expr expr, Dwarf_Error 
        Dwarf_Debug dbg;
        int len, pos, ret;
 
-       dbg = expr != NULL ? expr->pe_dbg : NULL;
+       dbg = expr->pe_dbg;
 
        if (expr->pe_block != NULL) {
                free(expr->pe_block);
@@ -88,7 +88,7 @@ _dwarf_expr_into_block(Dwarf_P_Expr expr, Dwarf_Error 
        pos = 0;
        STAILQ_FOREACH(ee, &expr->pe_eelist, ee_next) {
                assert((Dwarf_Unsigned) pos < expr->pe_length);
-               ret = _dwarf_loc_expr_add_atom(expr->pe_dbg,
+               ret = _dwarf_loc_expr_add_atom(dbg,
                    &expr->pe_block[pos], &expr->pe_block[expr->pe_length],
                    ee->ee_loc.lr_atom, ee->ee_loc.lr_number,
                    ee->ee_loc.lr_number2, &len, error);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to