File diff r26193:4bc7915a2156 → r26194:f7347205838e
src/string.cpp
Show inline comments
 
@@ -120,9 +120,9 @@ char *strecpy(char *dst, const char *src
 

	
 
	if (dst == last && *src != '\0') {
 
#if defined(STRGEN) || defined(SETTINGSGEN)
 
		error("String too long for destination buffer");
 
		error("String too long for destination buffer: %s", src);
 
#else /* STRGEN || SETTINGSGEN */
 
		Debug(misc, 0, "String too long for destination buffer");
 
		Debug(misc, 0, "String too long for destination buffer: {}", src);
 
#endif /* STRGEN || SETTINGSGEN */
 
	}
 
	return dst;
 
@@ -143,6 +143,16 @@ char *stredup(const char *s, const char 
 
	return tmp;
 
}
 

	
 
char *str_vfmt(const char *str, va_list va)
 
{
 
	char buf[4096];
 

	
 
	int len = vseprintf(buf, lastof(buf), str, va);
 
	char *p = MallocT<char>(len + 1);
 
	memcpy(p, buf, len + 1);
 
	return p;
 
}
 

	
 
/**
 
 * Format, "printf", into a newly allocated string.
 
 * @param str The formatting string.