From 31ce147c50e853f63b70048b0bbf71bb8889ca18 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Mon, 28 Aug 2023 07:43:34 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@efb0a921609cf06080308a6a7c321d451489db8a=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n_queue.c.fdfaa39d71447cf1e7d01ff206bd91e5.html | 1097 ++++++++++++++++++++ 1 file changed, 1097 insertions(+) create mode 100644 coverage/index.run_queue.c.fdfaa39d71447cf1e7d01ff206bd91e5.html (limited to 'coverage/index.run_queue.c.fdfaa39d71447cf1e7d01ff206bd91e5.html') diff --git a/coverage/index.run_queue.c.fdfaa39d71447cf1e7d01ff206bd91e5.html b/coverage/index.run_queue.c.fdfaa39d71447cf1e7d01ff206bd91e5.html new file mode 100644 index 0000000..6971eff --- /dev/null +++ b/coverage/index.run_queue.c.fdfaa39d71447cf1e7d01ff206bd91e5.html @@ -0,0 +1,1097 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/run_queue.c
Date:2023-08-28 07:33:56
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:436071.7%
Branches:61833.3%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2022 Egor Tensin <Egor.Tensin@gmail.com>
3 + * This file is part of the "cimple" project.
4 + * For details, see https://github.com/egor-tensin/cimple.
5 + * Distributed under the MIT License.
6 + */
7 +
8 + #include "run_queue.h"
9 + #include "log.h"
10 +
11 + #include <stdlib.h>
12 + #include <string.h>
13 + #include <sys/queue.h>
14 +
15 + struct run {
16 + int id;
17 + char *url;
18 + char *rev;
19 + SIMPLEQ_ENTRY(run) entries;
20 + };
21 +
22 + 27540int run_create(struct run **_entry, int id, const char *_url, const char *_rev)
23 + {
24 + 27540 struct run *entry = malloc(sizeof(struct run));
25 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 27540 times.
+
+
+
27540 if (!entry) {
26 + log_errno("malloc");
27 + goto fail;
28 + }
29 +
30 + 27540 char *url = strdup(_url);
31 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 27540 times.
+
+
+
27540 if (!url) {
32 + log_errno("strdup");
33 + goto free_entry;
34 + }
35 +
36 + 27540 char *rev = strdup(_rev);
37 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 27540 times.
+
+
+
27540 if (!rev) {
38 + log_errno("strdup");
39 + goto free_url;
40 + }
41 +
42 + 27540 entry->id = id;
43 + 27540 entry->url = url;
44 + 27540 entry->rev = rev;
45 +
46 + 27540 *_entry = entry;
47 + 27540 return 0;
48 +
49 + free_url:
50 + free(url);
51 +
52 + free_entry:
53 + free(entry);
54 +
55 + fail:
56 + return -1;
57 + }
58 +
59 + 27540void run_destroy(struct run *entry)
60 + {
61 + 27540 free(entry->rev);
62 + 27540 free(entry->url);
63 + 27540 free(entry);
64 + 27540}
65 +
66 + 45900int run_get_id(const struct run *entry)
67 + {
68 + 45900 return entry->id;
69 + }
70 +
71 + 64260const char *run_get_url(const struct run *entry)
72 + {
73 + 64260 return entry->url;
74 + }
75 +
76 + 36720const char *run_get_rev(const struct run *entry)
77 + {
78 + 36720 return entry->rev;
79 + }
80 +
81 + 9180void run_set_id(struct run *entry, int id)
82 + {
83 + 9180 entry->id = id;
84 + 9180}
85 +
86 + 29void run_queue_create(struct run_queue *queue)
87 + {
88 + 29 SIMPLEQ_INIT(queue);
89 + 29}
90 +
91 + 29void run_queue_destroy(struct run_queue *queue)
92 + {
93 + 29 struct run *entry1 = SIMPLEQ_FIRST(queue);
94 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 29 times.
+
+
+
29 while (entry1) {
95 + struct run *entry2 = SIMPLEQ_NEXT(entry1, entries);
96 + run_destroy(entry1);
97 + entry1 = entry2;
98 + }
99 + 29 SIMPLEQ_INIT(queue);
100 + 29}
101 +
102 + 27375int run_queue_is_empty(const struct run_queue *queue)
103 + {
104 + 27375 return SIMPLEQ_EMPTY(queue);
105 + }
106 +
107 + void run_queue_add_first(struct run_queue *queue, struct run *entry)
108 + {
109 + SIMPLEQ_INSERT_HEAD(queue, entry, entries);
110 + }
111 +
112 + 9180void run_queue_add_last(struct run_queue *queue, struct run *entry)
113 + {
114 + 9180 SIMPLEQ_INSERT_TAIL(queue, entry, entries);
115 + 9180}
116 +
117 + 9180struct run *run_queue_remove_first(struct run_queue *queue)
118 + {
119 + 9180 struct run *entry = SIMPLEQ_FIRST(queue);
120 +
+ 2/2 +
+
✓ Branch 0 taken 74 times.
+
✓ Branch 1 taken 9106 times.
+
+
+
9180 SIMPLEQ_REMOVE_HEAD(queue, entries);
121 + 9180 return entry;
122 + }
123 +
+
+ +
+ + + + -- cgit v1.2.3