[systemd-devel] [PATCH 1/2] condense assignment and path_kill_slashes calls
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Apr 20 19:53:24 PDT 2014
On Sat, Apr 19, 2014 at 01:33:28PM -0400, Dave Reisner wrote:
> ---
> Some of these are cases where the output variable is being modified,
> but since path_kill_slashes can't fail, I didn't see this as being
> controversial.
Looks OK.
Zbyszek
> src/shared/cgroup-util.c | 10 +++-------
> src/shared/path-util.c | 3 +--
> 2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
> index 9d50890..139888c 100644
> --- a/src/shared/cgroup-util.c
> +++ b/src/shared/cgroup-util.c
> @@ -472,9 +472,7 @@ static int join_path(const char *controller, const char *path, const char *suffi
> if (!t)
> return -ENOMEM;
>
> - path_kill_slashes(t);
> -
> - *fs = t;
> + *fs = path_kill_slashes(t);
> return 0;
> }
>
> @@ -957,8 +955,7 @@ int cg_split_spec(const char *spec, char **controller, char **path) {
> if (!t)
> return -ENOMEM;
>
> - path_kill_slashes(t);
> - *path = t;
> + *path = path_kill_slashes(t);
> }
>
> if (controller)
> @@ -1048,8 +1045,7 @@ int cg_mangle_path(const char *path, char **result) {
> if (!t)
> return -ENOMEM;
>
> - path_kill_slashes(t);
> - *result = t;
> + *result = path_kill_slashes(t);
> return 0;
> }
>
> diff --git a/src/shared/path-util.c b/src/shared/path-util.c
> index e35d7f8..373dd7a 100644
> --- a/src/shared/path-util.c
> +++ b/src/shared/path-util.c
> @@ -464,8 +464,7 @@ int find_binary(const char *name, char **filename) {
> continue;
>
> if (filename) {
> - path_kill_slashes(p);
> - *filename = p;
> + *filename = path_kill_slashes(p);
> p = NULL;
> }
>
> --
> 1.9.2
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
More information about the systemd-devel
mailing list