feature (string utils): replacing NULL reference strings in format with warning
This commit is contained in:
parent
b89c2fba83
commit
a6af38bb39
|
@ -71,7 +71,12 @@ uint64_t variadic_format_size(string_t string, va_list args) {
|
|||
}
|
||||
case 's': {
|
||||
// string
|
||||
uint64_t strlen = string_length(va_arg(args, string_t));
|
||||
string_t str = va_arg(args, string_t);
|
||||
if (str == NULL) {
|
||||
str = "<string NULL reference>";
|
||||
}
|
||||
|
||||
uint64_t strlen = string_length(str);
|
||||
if (numeric_specifier > 0) {
|
||||
strlen = MIN(strlen, numeric_specifier);
|
||||
}
|
||||
|
@ -202,6 +207,9 @@ void variadic_format(string_t output, string_t string, va_list args) {
|
|||
case 's': {
|
||||
// string
|
||||
string_t str = va_arg(args, string_t);
|
||||
if (str == NULL) {
|
||||
str = "<string NULL reference>";
|
||||
}
|
||||
uint64_t strlen = string_length(str);
|
||||
|
||||
if (numeric_specifier > 0) {
|
||||
|
|
Loading…
Reference in New Issue