4 ms·
This is cute, and probably useful for hobby projects. If I may, it would be nice to have slightly more generic versions of some of the interfaces, and perhaps c
by saagarjha 3y ago
This is cute, and probably useful for hobby projects. If I may, it would be nice to have slightly more generic versions of some of the interfaces, and perhaps consider dropping "maximally" efficient from your tagline. Not only is it cleaner, you are less likely to get yelled at by people who focus on code like this:
/* Function to concatenate multiple strings into a new string */
static inline char *concatenate(const char *str1, const char *str2)
{
size_t len1 = strlen(str1);
size_t len2 = strlen(str2);
char *result = (char *)malloc(len1 + len2 + 1);
strcpy(result, str1);
strcat(result, str2);
return result;
}