From patchwork Wed Dec 7 15:19:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 61662 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5215F382E446 for ; Wed, 7 Dec 2022 15:19:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5215F382E446 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670426393; bh=Qqi+/SyJ9iAH3Iev5Yx36aCyYx0jKs6FxAxsv1Oer+k=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=tUSDAhsyPy0PwDzDGxaZLVhajR72oMr0sIgbXjGLLkCSIExnYfDc7kIFgLg2Azw/l OETCxB8zOwWzQIsYdSn9YDFNq0R+l6HhMNwWO73dsh+p9BnuR+Xh5VD8BGTv2Tdl0r hDlwjfKPEFxVLG+XLQsmey9lVYfRVdWef45s1Y5w= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by sourceware.org (Postfix) with ESMTPS id F19533834C2C for ; Wed, 7 Dec 2022 15:19:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F19533834C2C Received: by mail-il1-x131.google.com with SMTP id a18so5443463ilk.9 for ; Wed, 07 Dec 2022 07:19:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qqi+/SyJ9iAH3Iev5Yx36aCyYx0jKs6FxAxsv1Oer+k=; b=4iNLtsFnLD5o4gXaOgb/eQw5Ub9tDtTOslJytHq6PkodzIs7oegauYUGdQ3QYK9ZG2 8ZHwtyqa611bV8u4OgIirZlBbyF/qwtZs5RMqijDYMZoWYi+lOZ8E+vCtyGUPJqRbHGx nv8Sbr2xvmFK7RqRFJJ3E0q8KVWw1bi3r0XbmK2jlNZ3nsYKUNZARUDKsAgZQRddJ7Rr AzlJsFZlSRcctLeKEnqd7zl/Rcsbv4kHVuQ2lyL66tC7hHsvs9om7ds2usuAa2PseszR N5tFZeiIOskd4cVZHkJJV9UtsDTFtGEJ02jwSIQqtjhRFb4k0ZImGa6iAoBkPC+AhGAg l5Og== X-Gm-Message-State: ANoB5pnm8Ds4yp31hCGyiw6QsMg/AXO9CFVZxkpUOSHDagQdiwk2kfVu zhGQlmZxMcCQWO9t/hOX8ivhclHceDXw3We6 X-Google-Smtp-Source: AA0mqf4WmdaY7SPa5nv56QJMZya9htUPl7+KhQRp5Fg36U8/UtZkzI6Yg57D9YSFeQqrH1SS/wl9jw== X-Received: by 2002:a05:6e02:f0e:b0:303:2603:c008 with SMTP id x14-20020a056e020f0e00b003032603c008mr16462779ilj.134.1670426369168; Wed, 07 Dec 2022 07:19:29 -0800 (PST) Received: from localhost.localdomain (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id t5-20020a02ab85000000b0038a434685dbsm3636604jan.102.2022.12.07.07.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 07:19:28 -0800 (PST) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [pushed] Remove unnecessary xstrdup from bppy_init Date: Wed, 7 Dec 2022 08:19:19 -0700 Message-Id: <20221207151919.2894085-1-tromey@adacore.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 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 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-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" I saw that bppy_init used a non-const "char *". Fixing this revealed that the xstrdup here was also unnecessary, so this patch removes it. --- gdb/python/py-breakpoint.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 7a757432948..63b18bd0f92 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -938,16 +938,14 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) } case bp_watchpoint: { - gdb::unique_xmalloc_ptr - copy_holder (xstrdup (skip_spaces (spec))); - char *copy = copy_holder.get (); + spec = skip_spaces (spec); if (access_type == hw_write) - watch_command_wrapper (copy, 0, internal_bp); + watch_command_wrapper (spec, 0, internal_bp); else if (access_type == hw_access) - awatch_command_wrapper (copy, 0, internal_bp); + awatch_command_wrapper (spec, 0, internal_bp); else if (access_type == hw_read) - rwatch_command_wrapper (copy, 0, internal_bp); + rwatch_command_wrapper (spec, 0, internal_bp); else error(_("Cannot understand watchpoint access type.")); break;