From 91f8798bf240d55fabc021739239d95bdcb1b4d4 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 26 Dec 2024 11:18:27 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@9f40d20e1c97e2c85e26a6a13ccf04e60d9f83f5=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....string.c.2a75186e465ffeac1b306a350f4a56f8.html | 486 +++++++++++++++++++++ 1 file changed, 486 insertions(+) create mode 100644 coverage/index.string.c.2a75186e465ffeac1b306a350f4a56f8.html (limited to 'coverage/index.string.c.2a75186e465ffeac1b306a350f4a56f8.html') diff --git a/coverage/index.string.c.2a75186e465ffeac1b306a350f4a56f8.html b/coverage/index.string.c.2a75186e465ffeac1b306a350f4a56f8.html new file mode 100644 index 0000000..f6108b7 --- /dev/null +++ b/coverage/index.string.c.2a75186e465ffeac1b306a350f4a56f8.html @@ -0,0 +1,486 @@ + + + + + + GCC Code Coverage Report + + + + + +
+

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/string.c
Date:2024-12-26 11:11:59
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:62227.3%
Functions:1250.0%
Branches:31618.8%
+
+
+ +
+
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2023 Egor Tensin <egor@tensin.name>
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 "string.h"
9 + #include "log.h"
10 +
11 + #include <errno.h>
12 + #include <stdlib.h>
13 + #include <string.h>
14 +
15 + /* glibc calls this stpecpy; it's not provided by glibc; however, it does
16 + * provide a possible implementation in string_copying(7), which I copied from. */
17 + 340226char *string_append(char *dst, char *end, const char *src)
18 + {
19 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 340226 times.
+
+
+
340226 if (!dst)
20 + return NULL;
21 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 340226 times.
+
+
+
340226 if (dst == end)
22 + return end;
23 +
24 + 340226 char *p = memccpy(dst, src, '\0', end - dst);
25 +
+ 1/2 +
+
✓ Branch 0 taken 340226 times.
+
✗ Branch 1 not taken.
+
+
+
340226 if (p)
26 + 340226 return p - 1;
27 +
28 + end[-1] = '\0';
29 + return end;
30 + }
31 +
32 + int string_to_int(const char *src, int *result)
33 + {
34 + char *endptr = NULL;
35 +
36 + errno = 0;
37 + long ret = strtol(src, &endptr, 10);
38 +
39 + if (errno) {
40 + log_errno("strtol");
41 + return -1;
42 + }
43 +
44 + if (endptr == src || *endptr != '\0') {
45 + log_err("Invalid number: %s\n", src);
46 + return -1;
47 + }
48 +
49 + *result = (int)ret;
50 + return 0;
51 + }
52 +
+
+
+
+ + + + -- cgit v1.2.3