Commit 5e8f578e authored by Max Kellermann's avatar Max Kellermann

util/ConcatString: return the end pointer

parent a4b1633e
......@@ -88,8 +88,7 @@ t_xstrcatdup(Args&&... args)
const size_t total = FillLengths(lengths, args...);
char *p = (char *)xalloc(total + 1);
StringCat(p, lengths, args...);
p[total] = 0;
*StringCat(p, lengths, args...) = 0;
return p;
}
......
......@@ -49,18 +49,18 @@ FillLengths(size_t *lengths, const char *a)
}
template<typename... Args>
void
char *
StringCat(char *p, const size_t *lengths, const char *a, Args&&... args)
{
StringCat(p, lengths, a);
StringCat(p + *lengths, lengths + 1, args...);
return StringCat(StringCat(p, lengths, a),
lengths + 1, args...);
}
template<>
void
char *
StringCat(char *p, const size_t *lengths, const char *a)
{
std::copy_n(a, *lengths, p);
return std::copy_n(a, *lengths, p);
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment