json: move empty string check from json_parse_file_at() to json_parse_with_source()

That way this error is generalized and applies to either function, since
one is just a wrapper to the other, normalizing behaviour.
This commit is contained in:
Lennart Poettering
2024-06-13 11:30:12 +02:00
parent 639256f380
commit aacbc2acb9
+3 -3
View File
@@ -3378,6 +3378,9 @@ _public_ int sd_json_parse_with_source(
_cleanup_(json_source_unrefp) JsonSource *s = NULL;
if (isempty(input))
return -ENODATA;
if (source) {
s = json_source_new(source);
if (!s)
@@ -3447,9 +3450,6 @@ _public_ int sd_json_parse_file_at(
if (r < 0)
return r;
if (isempty(text))
return -ENODATA;
return sd_json_parse_with_source(text, path, flags, ret, reterr_line, reterr_column);
}