From patchwork Fri Sep 6 19:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 34415 Received: (qmail 85711 invoked by alias); 6 Sep 2019 19:35:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85681 invoked by uid 89); 6 Sep 2019 19:35:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*MI:google X-HELO: mail-yw1-f73.google.com Received: from mail-yw1-f73.google.com (HELO mail-yw1-f73.google.com) (209.85.161.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Sep 2019 19:35:24 +0000 Received: by mail-yw1-f73.google.com with SMTP id a144so5528617ywe.17 for ; Fri, 06 Sep 2019 12:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=7tFG4LVmyns76HZ8PB+x604PkLyn+n57iNMia9PcphQ=; b=uq0lQnvzxclz44dGZzvFfgpEZ7zFraLExuO0SgyIRvGZDWBZ4qPIsWkGXVjMjdSXyP QOBqxF/dY9etXVHUC4f3T2Nqgy0ltPnfmwfHXfY1zDxSmgGe1kgDWu6GgJ9gwGyQ5fXz 4LBR+/DW0vLTL4seN++wVghNrsaRYzdDFkVrV/M0kOsTbz3HrK/v5PTbcUnNtRTcNwts xtXxQ14CJm11sML2CWofhbr/30VkFMptBVAap//SdchQ8311LbRl5hHOPBEwiq5tgXyZ Qwq9t1aAjX75NAssSJiJOfv73EgYD+fc5cjm48NGd2f9OpfAUcyu57Yq4d8rIGYDhaq8 J9TA== Date: Fri, 6 Sep 2019 14:35:19 -0500 Message-Id: <20190906193519.184112-1-cbiesinger@google.com> Mime-Version: 1.0 Subject: [PATCH] [PUSHED/OBVIOUS] Change int to bool for the relocate_* functions X-Patchwork-Original-From: "Christian Biesinger via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Christian Biesinger To: gdb-patches@sourceware.org Cc: Christian Biesinger X-IsSubscribed: yes These parameters are only used as bools. This also renames "flag" to "relocatable" to make it clearer what it does. gdb/ChangeLog: 2019-09-06 Christian Biesinger * defs.h (relocate_gdb_directory): Change int to bool in signature and rename flag to relocatable. * main.c (relocate_path): Likewise. (relocate_gdb_directory): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/defs.h | 2 +- gdb/main.c | 14 +++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 40bd4d0d02..acfc888aac 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-09-06 Christian Biesinger + + * defs.h (relocate_gdb_directory): Change int to bool in + signature and rename flag to relocatable. + * main.c (relocate_path): Likewise. + (relocate_gdb_directory): Likewise. + 2019-09-06 Alan Modra * coffread.c (coff_symfile_read): Constify filename variable. diff --git a/gdb/defs.h b/gdb/defs.h index ece3006de4..14e0a3e1d1 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -282,7 +282,7 @@ struct value; /* This really belong in utils.c (path-utils.c?), but it references some globals that are currently only available to main.c. */ -extern char *relocate_gdb_directory (const char *initial, int flag); +extern char *relocate_gdb_directory (const char *initial, bool relocatable); /* Annotation stuff. */ diff --git a/gdb/main.c b/gdb/main.c index 678c413021..129c57c1d1 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -139,14 +139,14 @@ set_gdb_data_directory (const char *new_datadir) /* Relocate a file or directory. PROGNAME is the name by which gdb was invoked (i.e., argv[0]). INITIAL is the default value for the - file or directory. FLAG is true if the value is relocatable, false - otherwise. Returns a newly allocated string; this may return NULL - under the same conditions as make_relative_prefix. */ + file or directory. RELOCATABLE is true if the value is relocatable, + false otherwise. Returns a newly allocated string; this may return + NULL under the same conditions as make_relative_prefix. */ static char * -relocate_path (const char *progname, const char *initial, int flag) +relocate_path (const char *progname, const char *initial, bool relocatable) { - if (flag) + if (relocatable) return make_relative_prefix (progname, BINDIR, initial); return xstrdup (initial); } @@ -158,11 +158,11 @@ relocate_path (const char *progname, const char *initial, int flag) function always returns a newly-allocated string. */ char * -relocate_gdb_directory (const char *initial, int flag) +relocate_gdb_directory (const char *initial, bool relocatable) { char *dir; - dir = relocate_path (gdb_program_name, initial, flag); + dir = relocate_path (gdb_program_name, initial, relocatable); if (dir) { struct stat s;