From d1cd99244f96bd95bbd67cc737248df346dec08b Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 25 Apr 2024 03:50:51 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@8e652dd2cb69928ea1596aa3e59845fef6854e2c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....string.c.2a75186e465ffeac1b306a350f4a56f8.html | 515 +++++++++++++++++++++ 1 file changed, 515 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..d4fd91c --- /dev/null +++ b/coverage/index.string.c.2a75186e465ffeac1b306a350f4a56f8.html @@ -0,0 +1,515 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/string.c
Date:2024-04-25 03:45:42
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:62227.3%
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 + 305444char *string_append(char *dst, char *end, const char *src)
18 + {
19 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 305444 times.
+
+
+
305444 if (!dst)
20 + return NULL;
21 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 305444 times.
+
+
+
305444 if (dst == end)
22 + return end;
23 +
24 + 305444 char *p = memccpy(dst, src, '\0', end - dst);
25 +
+ 1/2 +
+
✓ Branch 0 taken 305444 times.
+
✗ Branch 1 not taken.
+
+
+
305444 if (p)
26 + 305444 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