From: Jakub Jelinek <jakub@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: Ian Lance Taylor <ian@zembu.com>,
Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>,
binutils@sources.redhat.com
Subject: Re: [PATCH] Include alloca.h for bfd
Date: Thu, 23 Aug 2001 11:49:00 -0000 [thread overview]
Message-ID: <20010823205212.J5765@sunsite.ms.mff.cuni.cz> (raw)
In-Reply-To: <3B854EA7.7020706@cygnus.com>
On Thu, Aug 23, 2001 at 02:42:47PM -0400, Andrew Cagney wrote:
> > Hmm, shame you can't use asprintf(). It does everything you want
> >> except use bfd_malloc().
> >
> >
> > Now that you mention it, we could use asprintf there. There is an
> > implementation in libiberty. If it can't allocate memory, it sets the
> > buffer to NULL.
> >
> > Doesn't matter much, though.
>
> Yes. Its the bit where bfd_malloc() sets the error message that is missing.
Guess
size_t len = strlen (h->root.string);
char *buf = (char *) bfd_malloc (len + sizeof ("__imp_"));
memcpy (buf, "__imp_", sizeof ("__imp_") - 1);
memcpy (buf + sizeof ("__imp_") - 1, h->root.string, len + 1);
arh = archive_hash_lookup (&arsym_hash, buf, false, false);
free(buf);
will be faster anyway, so there is no need to look for asprintf for concat
of 2 strings together (well, the above would be even nicer with mempcpy).
Jakub
next prev parent reply other threads:[~2001-08-23 11:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-21 12:09 Thiemo Seufer
2001-08-21 13:20 ` Ian Lance Taylor
2001-08-21 14:46 ` Thiemo Seufer
2001-08-21 14:56 ` Ian Lance Taylor
2001-08-23 7:42 ` Nick Clifton
2001-08-23 8:48 ` Thiemo Seufer
2001-08-23 9:02 ` Jakub Jelinek
2001-08-23 9:15 ` Thiemo Seufer
2001-08-23 10:13 ` Andrew Cagney
2001-08-23 10:29 ` Ian Lance Taylor
2001-08-23 11:42 ` Andrew Cagney
2001-08-23 11:49 ` Jakub Jelinek [this message]
2001-08-23 10:16 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010823205212.J5765@sunsite.ms.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=ac131313@cygnus.com \
--cc=binutils@sources.redhat.com \
--cc=ian@zembu.com \
--cc=ica2_ts@csv.ica.uni-stuttgart.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).