@@ -845,29 +845,19 @@ int unlink_noerrno(const char *path);
845845 (void *) memset(_new_, 0, _len_); \
846846 })
847847
848- #define strappenda (a , b ) \
849- ({ \
850- const char *_a_ = (a), *_b_ = (b); \
851- char *_c_; \
852- size_t _x_, _y_; \
853- _x_ = strlen(_a_); \
854- _y_ = strlen(_b_); \
855- _c_ = alloca(_x_ + _y_ + 1); \
856- strcpy(stpcpy(_c_, _a_), _b_); \
857- _c_; \
858- })
859-
860- #define strappenda3 (a , b , c ) \
861- ({ \
862- const char *_a_ = (a), *_b_ = (b), *_c_ = (c); \
863- char *_d_; \
864- size_t _x_, _y_, _z_; \
865- _x_ = strlen(_a_); \
866- _y_ = strlen(_b_); \
867- _z_ = strlen(_c_); \
868- _d_ = alloca(_x_ + _y_ + _z_ + 1); \
869- strcpy(stpcpy(stpcpy(_d_, _a_), _b_), _c_); \
870- _d_; \
848+ #define strappenda (a , ...) \
849+ ({ \
850+ int _len = strlen(a); \
851+ unsigned _i; \
852+ char *_d_, *_p_; \
853+ const char *_appendees_[] = { __VA_ARGS__ }; \
854+ for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
855+ _len += strlen(_appendees_[_i]); \
856+ _d_ = alloca(_len + 1); \
857+ _p_ = stpcpy(_d_, a); \
858+ for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
859+ _p_ = stpcpy(_p_, _appendees_[_i]); \
860+ _d_; \
871861 })
872862
873863#define procfs_file_alloca (pid , field ) \
0 commit comments