Read-only archive of the Armageddon Games Forums Archive (2000–2026) · About this archive

Is something wrong with strip_extra_spaces?

0 replies · 2,565 views · Started 06 February 2024

In zq_strings.cpp we have:


// Don't actually use this to strip spaces.
char *strip_extra_spaces(char *string)

Why shouldn't I call this function? It is being called from void refresh in zquest.cpp, should we refactor that?

Note that there is an overload of strip_extra_spaces taking a std::string&

The char* overload is called by MsgString in zq_strings.cpp, which allocates a 71 character array on the heap to pass to strip_extra_spaces. It's probably fine to allocate that on the stack instead.