[systemd-devel] typo? path-util: unify code for detecting OS trees

Peeters Simon peeters.simon at gmail.com
Wed Apr 17 00:33:35 PDT 2013


while reading random patches in cgit I saw
(in commit 6606089752df90f3eeb4924af109046f1c73554c)

...
> diff --git a/src/shared/util.h b/src/shared/util.h
> index 3aac165..cfb5493 100644
> --- a/src/shared/util.h
> +++ b/src/shared/util.h
> @@ -684,3 +684,15 @@ int unlink_noerrno(const char *path);
> _new_ = alloca(_len_); \
> (void *) memset(_new_, 0, _len_); \
> })
> +
> +#define strappenda(a, b) \
> + ({ \
> + const char *_a_ = (a), *_b_ = (b); \
> + char *_c_; \
> + size_t _x_, _y_; \
> + _x_ = strlen(_a_); \
> + _y_ = strlen(_b_); \
> + _c_ = alloca(_x_ + _y_ + 1); \
> + strcpy(stpcpy(_c_, _a_), _b_); \

shouldn't this be more like:
strcat(strcpy(_c_, _a_), _b_);

> + _c_; \
> + })


More information about the systemd-devel mailing list