• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jcbf / smf-spf / 21120233602

18 Jan 2026 11:10PM UTC coverage: 14.381% (-0.5%) from 14.867%
21120233602

Pull #106

github

web-flow
Merge be3e4dbae into 6baf0fe8d
Pull Request #106: Fix/logto stderr error

95 of 387 new or added lines in 6 files covered. (24.55%)

3 existing lines in 1 file now uncovered.

108 of 751 relevant lines covered (14.38%)

0.24 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/utils/string_utils.c
1
/*
2
 * string_utils.c - String manipulation utilities for smf-spf
3
 *
4
 * This file is part of smf-spf.
5
 *
6
 * smf-spf is free software; you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation; either version 2 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * smf-spf is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 */
16

17
#include "string_utils.h"
18
#include <ctype.h>
19
#include <string.h>
20

NEW
21
void strscpy(char *dst, const char *src, size_t size) {
×
22
    size_t i;
23

NEW
24
    if (!dst || !src || size == 0) {
×
NEW
25
        if (dst && size > 0) {
×
NEW
26
            dst[0] = '\0';
×
27
        }
NEW
28
        return;
×
29
    }
30

NEW
31
    for (i = 0; i < size - 1 && src[i] != '\0'; i++) {
×
NEW
32
        dst[i] = src[i];
×
33
    }
NEW
34
    dst[i] = '\0';
×
35
}
36

NEW
37
void strtolower(char *str) {
×
NEW
38
    if (!str) {
×
39
        return;
40
    }
41

NEW
42
    while (*str) {
×
NEW
43
        if (isascii(*str) && isupper(*str)) {
×
NEW
44
            *str = tolower(*str);
×
45
        }
NEW
46
        str++;
×
47
    }
48
}
49

NEW
50
char *trim_space(char *str) {
×
51
    char *end;
52

NEW
53
    if (!str) {
×
54
        return NULL;
55
    }
56

57
    /* Skip leading whitespace */
NEW
58
    while (isspace((unsigned char)*str)) {
×
NEW
59
        str++;
×
60
    }
61

62
    /* All spaces? */
NEW
63
    if (*str == '\0') {
×
64
        return str;
65
    }
66

67
    /* Trim trailing whitespace */
NEW
68
    end = str + strlen(str) - 1;
×
NEW
69
    while (end > str && isspace((unsigned char)*end)) {
×
NEW
70
        end--;
×
71
    }
72

73
    /* Write null terminator */
NEW
74
    *(end + 1) = '\0';
×
75

NEW
76
    return str;
×
77
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc