Skip to content

Commit 30d47ed

Browse files
committed
print.h: fix ODR exebook#8
1 parent bb3f0cd commit 30d47ed

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

print.h

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
#ifndef PRINT_H
2+
#define PRINT_H
3+
4+
#include <stdbool.h>
15
#include <stdarg.h>
26
#include <stdio.h>
37

4-
int __print_enable_color = 1;
8+
static int __print_enable_color = 1;
59

6-
void __print_color(FILE* fd, int a) {
10+
static void __print_color(FILE* fd, int a) {
711
if (!__print_enable_color) return;
812
if (a == -1) fputs("\x1b(B\x1b[m", fd);
913
else fprintf(fd, "\x1b[38;5;%im", a);
@@ -24,21 +28,21 @@ void __print_color(FILE* fd, int a) {
2428
if (n > max_len) fputs("...", fd); \
2529
fputc(']', fd);
2630

27-
int __print_color_normal = -1; // -1 means default terminal foreground color
28-
int __print_color_number = 4;
29-
int __print_color_string = 1;
30-
int __print_color_hex = 2;
31-
int __print_color_float = 5;
31+
static int __print_color_normal = -1; // -1 means default terminal foreground color
32+
static int __print_color_number = 4;
33+
static int __print_color_string = 1;
34+
static int __print_color_hex = 2;
35+
static int __print_color_float = 5;
3236

33-
void __print_setup_colors(int normal, int number, int string, int hex, int fractional) {
37+
static void __print_setup_colors(int normal, int number, int string, int hex, int fractional) {
3438
__print_color_string = string;
3539
__print_color_number = number;
3640
__print_color_hex = hex;
3741
__print_color_normal = normal;
3842
__print_color_float = fractional;
3943
}
4044

41-
void __print_func (FILE *fd, int count, unsigned short types[], ...) {
45+
static void __print_func (FILE *fd, int count, unsigned short types[], ...) {
4246
va_list v;
4347
va_start(v, types);
4448
#ifdef __print_DEBUG
@@ -197,3 +201,4 @@ void __print_func (FILE *fd, int count, unsigned short types[], ...) {
197201

198202
#define print(a...) fprint(stdout, a)
199203

204+
#endif

0 commit comments

Comments
 (0)