From: Hleb Valoshka <firstname.lastname@example.org>
Subject: Re: Re: [PATCH] Remove Scope IDs from IPv6 addresses.
Date: Tue, 10 Sep 2013 22:57:33 +0300 [thread overview]
Message-ID: <CAAB-KcnSoHwcpMPBOdvHascKUsXMngyOhWmeXRJE=ZzP-Xn6email@example.com> (raw)
On 9/10/13, Eric Wong <firstname.lastname@example.org> wrote:
>> + newaddr = strdup(addr);
>> + if (newaddr == NULL)
>> + perror("strdup");
> We'll segfault on strchr below if we perrored above. If we continue
> using strdup, I would just use ruby_strdup() (works on both MRI/rbx).
I haven't use C for a long time, so I thought that strchr checks its args.
> But I'd rather avoid *strdup entirely. This is unlikely to
> remove, right?
Frankly speaking I dislike functions similar to strdup(), because
using them you should remember to call free(), sometimes in many
places (or to use goto). But I'm unfamiliar with internal ruby api, so
it was the only variant for me.
BTW, is anything bad with that variant:
char *newaddr = alloca(...);
> Perhaps something like this (totally untested, likely off-by-one errors)
Ok, I'll test your code tomorrow.
next prev parent reply other threads:[~2013-09-10 19:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <email@example.com>
[not found] ` <20130910183504.GA502@dcvr.yhbt.net>
2013-09-10 18:36 ` [PATCH] Remove Scope IDs from IPv6 addresses Eric Wong
2013-09-10 19:57 ` Hleb Valoshka [this message]
2013-09-10 20:17 ` Eric Wong
2013-09-11 16:12 ` Hleb Valoshka
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:
List information: https://yhbt.net/raindrops/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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.
Code repositories for project(s) associated with this public inbox
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).