[FFmpeg-devel] [PATCH] IPv6 support v.2

Luca Abeni lucabe72
Wed Nov 7 16:16:35 CET 2007


Hi Ronald,

Ronald S. Bultje wrote:
> Hi,
> 
> On Nov 7, 2007 7:02 AM, Luca Abeni <lucabe72 at email.it> wrote:
> 
>> Can you split the patch and send the part which just removes duplicated
>> code?
>> If yes, then I think that part (just reorganization of the code, without
>> any
>> change in the behaviour) can be committed soon.
> 
> 
> Sure, Quite clearly, that will result in temporary lack of ipv6 support
> until my new patches have been applied, is that OK?

No, this is not what I meant... I was thinking about code reorganization
only, without any change in the behaviour (so, without removing IPv6
support).
Let me make an example... In udp.c, we have things like:
int udp_set_remote_url(URLContext *h, const char *uri)
{
#ifdef CONFIG_IPV6
     return udp_ipv6_set_remote_url(h, uri);
#else
     UDPContext *s = h->priv_data;
     char hostname[256];
     int port;

     url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);

     /* set the destination address */
     if (resolve_host(&s->dest_addr.sin_addr, hostname) < 0)
         return AVERROR(EIO);
     s->dest_addr.sin_family = AF_INET;
     s->dest_addr.sin_port = htons(port);
     return 0;
#endif
}
and
static int udp_ipv6_set_remote_url(URLContext *h, const char *uri) {
     UDPContext *s = h->priv_data;
     char hostname[256];
     int port;
     struct addrinfo *res0;
     url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
     res0 = udp_ipv6_resolve_host(hostname, port, SOCK_DGRAM, AF_UNSPEC, 0);
     if (res0 == 0) return AVERROR(EIO);
     memcpy(&s->dest_addr, res0->ai_addr, res0->ai_addrlen);
     s->dest_addr_len = res0->ai_addrlen;
     freeaddrinfo(res0);
     return 0;
}

Now, udp_ipv6_set_remote_url() is very similar to the code in
udp_set_remote_url()... This is an example of the code duplication I
was referring to... Isn't this the code duplication you addressed in
your patch?
I think this kind of duplication can be removed without any change in
the functionalities (so, without loosing IPv6 support).


			Thanks,
				Luca




More information about the ffmpeg-devel mailing list