On Monday 28 November 2011 10:22:42 Nikolaus Voss wrote:
> --- a/extra/Configs/Config.in
> +++ b/extra/Configs/Config.in
> 
> +config UCLIBC_HAS_AVAHI_RES
> +     default y

this should not default to "on" ;)

> +     depends on UCLIBC_HAS_SOCKET

i think this should be:
        depends on UCLIBC_HAS_IPV4 || UCLIBC_HAS_IPV6

> --- /dev/null
> +++ b/libc/inet/avahi.c
>
> +static FILE* avahi_open_socket(void)

static FILE *avahi_open_......

> +     int fd = -1;

not really needed to set to -1 since the first thing you do is assign it

> +     if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0)

let's get away from inlining assignments in "if" statements:
        fd = socket(...);
        if (fd < 0)
                ...

this applies to a bunch of places in this patch ...

> +#ifndef __ASSUME_SOCK_CLOEXEC
> +     fcntl_not_cancel(fd, F_SETFD, FD_CLOEXEC);
> +#endif

i think you're missing the update to kernel-features.h ;)

> +             sizeof(sa.sun_path)-1);
> +     sa.sun_path[sizeof(sa.sun_path)-1] = 0;

space around that "-"

> +     if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0)

space before the "*"

> +fail:
> +     if (fd >= 0)
> +             close(fd);

add a different label to skip the close() and thus avoid the if check

> +static int avahi_ends_with(const char *name, const char* suffix) {

brace needs to be on the 2nd line

> +     assert(name);
> +     assert(suffix);

the C library should not assert() :).  return an error.

> +int attribute_hidden __avahi_resolve_name(int af, const char* name, void*

the hidden attribute is in the header file which you've included, so you don't 
need it here

> +finish:
> +     if (f)
> +             fclose(f);

use a diff label to return early to avoid the if check

> --- /dev/null
> +++ b/libc/inet/avahi.h
>
> +#ifndef _AVAHI_H_
> +#define _AVAHI_H_

might want to put UCLIBC in there just in case ...

> --- a/libc/inet/resolv.c
> +++ b/libc/inet/resolv.c
>
> +     // is this a .local address?

no C++ comments.  use /* comment */ style.

> +     if (!__avahi_resolve_address(type, in, buf, buflen))
> +     {

cuddle up that brace
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to