[systemd-devel] [PATCH] login/sd-login.c: make use of _cleanup_free_ and friends

Lennart Poettering lennart at poettering.net
Wed Apr 17 07:25:40 PDT 2013


On Wed, 17.04.13 16:12, harald at redhat.com (harald at redhat.com) wrote:

> -        char *root, *cgroup, *p, *cc;
> +        char _cleanup_free_ *root = NULL, *cgroup = NULL, *p = NULL, *cc = NULL;

Hmm, can we agree on a common syntax for this?

I tend to put the "_cleanup_free_" before the type, and Zbigniew and
Harald after.

I kinda prefer putting it first, since it puts the emphasis on the
cleanup logic, which I think is a good thing, since that's really
important to grok the code. i.e. the cleanup stuff is not unessential
decoration, but really important, so putting it first sounds good to me.

            _cleanup_free_ char *s = NULL;
            char _cleanup_free_ char *t = NULL;

I much prefer the first syntax...

Opinions?

Patch looks good otherwise.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list