On Sun, 19.09.10 21:25, Tom Gundersen (t...@jklm.no) wrote:

>  
> +#ifdef TARGET_ARCH
> +     if ((r = parse_env_file("/etc/rc.conf", NEWLINE,
> +                             "DAEMONS", &arch_daemons,
> +                             NULL)) < 0) {
> +             if (r != -ENOENT)
> +                     log_warning("Failed to read /etc/rc.conf: %s", 
> strerror(-r));
> +     }
> +     else if (arch_daemons) {
> +             for (i=0; i < strlen(arch_daemons); i++) { /* strip of end 
> paren */
> +                     if (arch_daemons[i] == ')') {
> +                             arch_daemons[i] = 0;
> +                             break;
> +                     }
> +             }

Looks like this could be simplified as:

arch_daemons[strcspn(arch_daemons, ")"] = 0;

> +             for (i=0; i < strlen(arch_daemons); i++) { /* find position of 
> start paren */
> +                     if (arch_daemons[i] == '(') {
> +                             i++;
> +                             break;
> +                     }
> +             }

Similarly here:

if (!(p = strchr(arch_deamons, '('))))
        p = arch_daemons;

And then just use p from then on.

Otherwise looks fine!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to