GCC Code Coverage Report


Directory: src/
File: msg-json-utils.c
Date: 2025-05-17 00:53:34
Exec Total Coverage
Lines: 7 8 87.5%
Functions: 2 2 100.0%
Branches: 3 4 75.0%

Line Branch Exec Source
1 /* Copyright 2024 Jan-Michael Brummer
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #include "msg-json-utils.h"
18
19 const char *
20 373 msg_json_object_get_string (JsonObject *object,
21 const char *name)
22 {
23
2/2
✓ Branch 0 taken 319 times.
✓ Branch 1 taken 54 times.
373 if (json_object_has_member (object, name))
24 319 return json_object_get_string_member (object, name);
25
26 54 return NULL;
27 }
28
29 gboolean
30 4 msg_json_object_get_boolean (JsonObject *object,
31 const char *name)
32 {
33
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (json_object_has_member (object, name)) {
34 4 return json_object_get_boolean_member (object, name);
35 }
36
37 return FALSE;
38 }
39