File Coverage

ext/xxHash/cli/xsum_output.c
Criterion Covered Total %
statement 0 15 0.0
branch 0 2 0.0
condition n/a
subroutine n/a
pod n/a
total 0 17 0.0


line stmt bran cond sub pod time code
1             /*
2             * xxhsum - Command line interface for xxhash algorithms
3             * Copyright (C) 2013-2020 Yann Collet
4             *
5             * GPL v2 License
6             *
7             * This program is free software; you can redistribute it and/or modify
8             * it under the terms of the GNU General Public License as published by
9             * the Free Software Foundation; either version 2 of the License, or
10             * (at your option) any later version.
11             *
12             * This program is distributed in the hope that it will be useful,
13             * but WITHOUT ANY WARRANTY; without even the implied warranty of
14             * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15             * GNU General Public License for more details.
16             *
17             * You should have received a copy of the GNU General Public License along
18             * with this program; if not, write to the Free Software Foundation, Inc.,
19             * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20             *
21             * You can contact the author at:
22             * - xxHash homepage: https://www.xxhash.com
23             * - xxHash source repository: https://github.com/Cyan4973/xxHash
24             */
25              
26             #include "xsum_output.h"
27             #include "xsum_os_specific.h"
28             #include
29              
30             int XSUM_logLevel = 2;
31              
32             XSUM_ATTRIBUTE((__format__(__printf__, 1, 2)))
33 0           XSUM_API int XSUM_log(const char* format, ...)
34             {
35             int ret;
36             va_list ap;
37 0           va_start(ap, format);
38 0           ret = XSUM_vfprintf(stderr, format, ap);
39 0           va_end(ap);
40 0           return ret;
41             }
42              
43              
44             XSUM_ATTRIBUTE((__format__(__printf__, 1, 2)))
45 0           XSUM_API int XSUM_output(const char* format, ...)
46             {
47             int ret;
48             va_list ap;
49 0           va_start(ap, format);
50 0           ret = XSUM_vfprintf(stdout, format, ap);
51 0           va_end(ap);
52 0           return ret;
53             }
54              
55             XSUM_ATTRIBUTE((__format__(__printf__, 2, 3)))
56 0           XSUM_API int XSUM_logVerbose(int minLevel, const char* format, ...)
57             {
58 0 0         if (XSUM_logLevel >= minLevel) {
59             int ret;
60             va_list ap;
61 0           va_start(ap, format);
62 0           ret = XSUM_vfprintf(stderr, format, ap);
63 0           va_end(ap);
64             return ret;
65             }
66             return 0;
67             }