From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 58888385782D for ; Thu, 26 May 2022 16:49:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 58888385782D Received: by mail-il1-x134.google.com with SMTP id v7so1428987ilj.7 for ; Thu, 26 May 2022 09:49:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yB+rvYd0mA3iVBQ6pf9Pn4PBpx5ppmyOO92IF8IWpzU=; b=omIOWcGHs02oYv8hZbwaM0mkIjDRqY3/q+z1GtjyA2CutGOwMUHV0aG47mdqHGLi6E 0mELkKAShF/H9DNWLGM+NmJDNSe6JkbwmQN0G18dl6qF4K1LAnwUXGf7afzyEFHBoptf pa10PdOwEcfZ7V8qHQ+Vrflj8KhKI0R3qVUj1+sfUvE2tm/dUf21BcvHPuHsfzBeqxJO Y0ngX+ZhqrCjcWy/t9xj0nGhYpGlAX8t9ujKnDPlVN/a6kyuo0bCUjhgadW76f3HOwWy KbSJOkBublRqH5d3+u31COAZFZ5gHuArV+TpHtVVwXTLE4/zqb9sM+iqCf9ESoHLGOHa zPbQ== X-Gm-Message-State: AOAM530vwvwpBC8r66bz/IsLp/If0eeAPe0XHTLlnBMs5tsZCcJxE0Ae L9x2Iuc3g4/YD8z9iXXgFdbXduZRsgY+wg== X-Google-Smtp-Source: ABdhPJyh4A85hIMhptPkqHKRlANI1ohWYvWRkiXumA4DlqDUW8LlvoTu2MhrUm/E0WayfqyEKyc66w== X-Received: by 2002:a05:6e02:184b:b0:2d1:cec4:89e0 with SMTP id b11-20020a056e02184b00b002d1cec489e0mr7050255ilv.40.1653583748536; Thu, 26 May 2022 09:49:08 -0700 (PDT) Received: from murgatroyd.Home (71-211-158-194.hlrn.qwest.net. [71.211.158.194]) by smtp.gmail.com with ESMTPSA id z11-20020a056638000b00b0032eaac8e978sm512342jao.153.2022.05.26.09.49.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 09:49:08 -0700 (PDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Simplify varobj "change" logic Date: Thu, 26 May 2022 10:49:06 -0600 Message-Id: <20220526164906.1096660-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2022 16:49:11 -0000 varobj used to store 'print_value' as a C string, where NULL was a valid value, and so it had logic to handle this situation. However, at some point this was changed to be a std::string, and so the code can be simplified in this spot. --- gdb/varobj.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gdb/varobj.c b/gdb/varobj.c index 741fdb6a03b..1aca015a21a 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1344,11 +1344,8 @@ install_new_value (struct varobj *var, struct value *value, bool initial) { print_value = varobj_value_get_print_value (var->value.get (), var->format, var); - if ((var->print_value.empty () && !print_value.empty ()) - || (!var->print_value.empty () && print_value.empty ()) - || (!var->print_value.empty () && !print_value.empty () - && var->print_value != print_value)) - changed = true; + if (var->print_value != print_value) + changed = true; } var->print_value = print_value; -- 2.34.1