mirror of https://github.com/GNOME/gimp.git
libgimpconfig: allow calling gimp_scanner_new_string (NULL, -1, ...)
Allow calling gimp_scanner_new_string() with a NULL `text` and a negative `text_len` (which is interpreted as 0), instead of requiring `text_len == 0` in this case. This allows passing a negative `text_len` unconditionally to infer the length, even when the string may be NULL.
This commit is contained in:
parent
cd2adfbede
commit
dcea2348c6
|
@ -243,11 +243,11 @@ gimp_scanner_new_string (const gchar *text,
|
|||
{
|
||||
GimpScanner *scanner;
|
||||
|
||||
g_return_val_if_fail (text != NULL || text_len == 0, NULL);
|
||||
g_return_val_if_fail (text != NULL || text_len <= 0, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (text_len < 0)
|
||||
text_len = strlen (text);
|
||||
text_len = text ? strlen (text) : 0;
|
||||
|
||||
scanner = gimp_scanner_new (NULL, NULL, NULL, error);
|
||||
|
||||
|
|
Loading…
Reference in New Issue