util/ConcatString: return the end pointer
This commit is contained in:
parent
a4b1633e11
commit
5e8f578e78
@ -88,8 +88,7 @@ t_xstrcatdup(Args&&... args)
|
|||||||
const size_t total = FillLengths(lengths, args...);
|
const size_t total = FillLengths(lengths, args...);
|
||||||
|
|
||||||
char *p = (char *)xalloc(total + 1);
|
char *p = (char *)xalloc(total + 1);
|
||||||
StringCat(p, lengths, args...);
|
*StringCat(p, lengths, args...) = 0;
|
||||||
p[total] = 0;
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,18 +49,18 @@ FillLengths(size_t *lengths, const char *a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
void
|
char *
|
||||||
StringCat(char *p, const size_t *lengths, const char *a, Args&&... args)
|
StringCat(char *p, const size_t *lengths, const char *a, Args&&... args)
|
||||||
{
|
{
|
||||||
StringCat(p, lengths, a);
|
return StringCat(StringCat(p, lengths, a),
|
||||||
StringCat(p + *lengths, lengths + 1, args...);
|
lengths + 1, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void
|
char *
|
||||||
StringCat(char *p, const size_t *lengths, const char *a)
|
StringCat(char *p, const size_t *lengths, const char *a)
|
||||||
{
|
{
|
||||||
std::copy_n(a, *lengths, p);
|
return std::copy_n(a, *lengths, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user