about summary refs log tree commit diff stats
path: root/src/common.h
diff options
context:
space:
mode:
authorSteffen Jaeckel <jaeckel-floss@eyet-services.de>2023-05-11 11:20:52 +0200
committerMichael Vetter <jubalh@iodoru.org>2023-05-12 08:39:23 +0200
commit197b839944c139672e2aa1e9e83632630138f6a7 (patch)
tree63e878abbe3547fda9d14082be71d36c864862ea /src/common.h
parent12d76e4a214c392e6e3daa5fd9bcf816addf8746 (diff)
downloadprofani-tty-197b839944c139672e2aa1e9e83632630138f6a7.tar.gz
Remove VLA & calm Valgrind
`MB_CUR_MAX` looks like a macro, but it's a function call and therefore
creates a VLA. We don't want that.

Also this array being uninitialized created the following Valgrind error

```
==503529== Conditional jump or move depends on uninitialised value(s)
==503529==    at 0x619F15E: waddnstr (lib_addstr.c:67)
==503529==    by 0x1929B7: _inp_write (inputwin.c:353)
==503529==    by 0x1937D5: _inp_redisplay (inputwin.c:619)
==503529==    by 0x61511B1: rl_forced_update_display (display.c:2693)
==503529==    by 0x193F9D: _inp_rl_send_to_editor (inputwin.c:957)
==503529==    by 0x614642F: _rl_dispatch_subseq (readline.c:916)
==503529==    by 0x6146C85: _rl_dispatch_callback (readline.c:823)
==503529==    by 0x616739F: rl_callback_read_char (callback.c:241)
==503529==    by 0x1923DB: inp_readline (inputwin.c:188)
==503529==    by 0x149860: prof_run (profanity.c:117)
==503529==    by 0x2283E8: main (main.c:186)
==503529==  Uninitialised value was created by a stack allocation
==503529==    at 0x1928B1: _inp_write (inputwin.c:334)
```

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common.h b/src/common.h
index dee4a092..6f08d959 100644
--- a/src/common.h
+++ b/src/common.h
@@ -60,6 +60,9 @@ void auto_free_char(char** str);
 #define STR_MAYBE_NULL(p) (p)
 #endif
 
+/* Our own define of MB_CUR_MAX but this time at compile time */
+#define PROF_MB_CUR_MAX 8
+
 // assume malloc stores at most 8 bytes for size of allocated memory
 // and page size is at least 4KB
 #define READ_BUF_SIZE 4088
tik K. Agaram <vc@akkartik.com> 2015-04-22 12:43:38 -0700 committer Kartik K. Agaram <vc@akkartik.com> 2015-04-22 12:43:38 -0700 1130' href='/akkartik/mu/commit/cpp/001test?h=main&id=2ed1aa9c5661ec9ee32fe9fbdc230c29d30d27e4'>2ed1aa9c ^
51530916 ^

de49fb42 ^


b39ceb27 ^
df0b469f ^
b39ceb27 ^






51530916 ^
b39ceb27 ^
9e608a77 ^

ac0e9db5 ^
6179649e ^
9e608a77 ^


b39ceb27 ^
683d53ca ^
b39ceb27 ^


683d53ca ^

b39ceb27 ^
df0b469f ^
ccd792da ^
51530916 ^
ac0e9db5 ^
7d13531e ^



eb3a527a ^


fb4836dc ^
eb3a527a ^
51530916 ^

0f125d5f ^
ac0e9db5 ^
86acd630 ^

0f125d5f ^
eb3a527a ^
65ccad4c ^
6673e1fc ^
40be2522 ^
eb3a527a ^



51530916 ^
f278a15d ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98