#include /** * Gets the buffer size to allocate based on the given components. * * @param components An array of null-terminated C strings to measure the length of * @param num_components The number of items in the components array. * * @return The buffer size to allocate, excluding the null terminator */ size_t get_buffer_size(const char **components, int num_components) { size_t buffer_size = 0; for (int i = 0; i < num_components; i++) { buffer_size += strlen(components[i]); } return buffer_size; }