From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32623 invoked by alias); 24 May 2013 02:59:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32613 invoked by uid 89); 24 May 2013 02:59:52 -0000 X-Spam-SWARE-Status: No, score=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_XS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 24 May 2013 02:59:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4O2xnPq029153 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 May 2013 22:59:50 -0400 Received: from psique (ovpn-113-83.phx2.redhat.com [10.3.113.83]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r4O2xkCS002226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 23 May 2013 22:59:48 -0400 From: Sergio Durigan Junior To: Svante Signell Cc: gdb-patches@sourceware.org Subject: Re: Small patch to enable build of gdb-7.6 for GNU/Hurd References: <1369326967.8127.33.camel@s1499.it.kth.se> X-URL: http://www.redhat.com Date: Fri, 24 May 2013 02:59:00 -0000 In-Reply-To: <1369326967.8127.33.camel@s1499.it.kth.se> (Svante Signell's message of "Thu, 23 May 2013 18:36:07 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-05/txt/msg00901.txt.bz2 Thanks for your patch, Svante. On Thursday, May 23 2013, Svante Signell wrote: > --- a/gdb/nto-tdep.c 2013-05-23 14:28:24.000000000 +0000 > +++ b/gdb/nto-tdep.c 2013-05-23 15:01:24.000000000 +0000 > @@ -147,9 +147,11 @@ nto_find_and_open_solib (char *solib, un > void > nto_init_solib_absolute_prefix (void) > { > - char buf[PATH_MAX * 2], arch_path[PATH_MAX]; > + char *buf, *arch_path; > char *nto_root, *endian; > const char *arch; > + int arch_len, len; > +#define FMT "set solib-absolute-prefix %s" > > nto_root = nto_target (); > if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0) > @@ -172,9 +174,13 @@ nto_init_solib_absolute_prefix (void) > == BFD_ENDIAN_BIG ? "be" : "le"; > } > > - xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian); > + arch_len = strlen (nto_root) + 1 + strlen (arch) + strlen (endian) + 1; > + arch_path = alloca (arch_len); > + xsnprintf (arch_path, arch_len, "%s/%s%s", nto_root, arch, endian); > > - xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_path); > + len = strlen (FMT) - 2 + strlen (arch_path) + 1; > + buf = alloca (len); > + xsnprintf (buf, len, FMT, arch_path); When I define things in the middle of functions/code, I usually #undef them just after I finished using, to avoid conflicts with others #defines. Specially when the #define is called "FMT", which is very generic IMO. But that is just a good practice I try to follow. -- Sergio