public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] posix: Remove alloca_account usage on getaddrinfo
Date: Tue, 15 Mar 2022 18:38:25 +0000 (GMT) [thread overview]
Message-ID: <20220315183825.13CBA385841E@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=41ca2b14515a2808e6a7f80a464abc0f0a222d9b
commit 41ca2b14515a2808e6a7f80a464abc0f0a222d9b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Wed Mar 9 18:31:30 2022 -0300
posix: Remove alloca_account usage on getaddrinfo
Diff:
---
sysdeps/posix/getaddrinfo.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 13372e8d47..f22c36a262 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -336,10 +336,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
const char *canon = NULL;
const char *orig_name = name;
- /* Reserve stack memory for the scratch buffer in the getaddrinfo
- function. */
- size_t alloca_used = sizeof (struct scratch_buffer);
-
if (req->ai_protocol || req->ai_socktype)
{
++tp;
@@ -371,7 +367,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (tp->name[0])
{
st = (struct gaih_servtuple *)
- alloca_account (sizeof (struct gaih_servtuple), alloca_used);
+ alloca (sizeof (struct gaih_servtuple));
int rc = gaih_inet_serv (service->name, tp, req, st, tmpbuf);
if (__glibc_unlikely (rc != 0))
@@ -396,8 +392,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
continue;
newp = (struct gaih_servtuple *)
- alloca_account (sizeof (struct gaih_servtuple),
- alloca_used);
+ alloca (sizeof (struct gaih_servtuple));
if (gaih_inet_serv (service->name,
tp, req, newp, tmpbuf) != 0)
@@ -422,7 +417,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (req->ai_socktype || req->ai_protocol)
{
- st = alloca_account (sizeof (struct gaih_servtuple), alloca_used);
+ st = alloca (sizeof (struct gaih_servtuple));
st->next = NULL;
st->socktype = tp->socktype;
st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
@@ -439,8 +434,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
{
struct gaih_servtuple *newp;
- newp = alloca_account (sizeof (struct gaih_servtuple),
- alloca_used);
+ newp = alloca (sizeof (struct gaih_servtuple));
newp->next = NULL;
newp->socktype = tp->socktype;
newp->protocol = tp->protocol;
@@ -459,7 +453,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
if (name != NULL)
{
- at = alloca_account (sizeof (struct gaih_addrtuple), alloca_used);
+ at = alloca (sizeof (struct gaih_addrtuple));
at->family = AF_UNSPEC;
at->scopeid = 0;
at->next = NULL;
@@ -940,7 +934,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
else
{
struct gaih_addrtuple *atr;
- atr = at = alloca_account (sizeof (struct gaih_addrtuple), alloca_used);
+ atr = at = alloca (sizeof (struct gaih_addrtuple));
memset (at, '\0', sizeof (struct gaih_addrtuple));
if (req->ai_family == AF_UNSPEC)
next reply other threads:[~2022-03-15 18:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 18:38 Adhemerval Zanella [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-03-16 18:00 Adhemerval Zanella
2022-03-11 17:22 Adhemerval Zanella
2022-03-10 19:21 Adhemerval Zanella
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=20220315183825.13CBA385841E@sourceware.org \
--to=azanella@sourceware.org \
--cc=glibc-cvs@sourceware.org \
/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).