clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name keymaps.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/gnu/lib/libreadline/obj -resource-dir /usr/local/lib/clang/13.0.0 -D HAVE_CONFIG_H -I /usr/src/gnu/lib/libreadline -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/gnu/lib/libreadline/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c /usr/src/gnu/lib/libreadline/keymaps.c
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | #define READLINE_LIBRARY |
22 | |
23 | #if defined (HAVE_CONFIG_H) |
24 | # include <config.h> |
25 | #endif |
26 | |
27 | #if defined (HAVE_STDLIB_H) |
28 | # include <stdlib.h> |
29 | #else |
30 | # include "ansi_stdlib.h" |
31 | #endif /* HAVE_STDLIB_H */ |
32 | |
33 | #include <stdio.h> /* for FILE * definition for readline.h */ |
34 | |
35 | #include "readline.h" |
36 | #include "rlconf.h" |
37 | |
38 | #include "emacs_keymap.c" |
39 | |
40 | #if defined (VI_MODE) |
41 | #include "vi_keymap.c" |
42 | #endif |
43 | |
44 | #include "xmalloc.h" |
45 | |
46 | |
47 | |
48 | |
49 | |
50 | |
51 | |
52 | |
53 | |
54 | |
55 | Keymap |
56 | rl_make_bare_keymap () |
57 | { |
58 | register int i; |
59 | Keymap keymap = (Keymap)xmalloc (KEYMAP_SIZE * sizeof (KEYMAP_ENTRY)); |
60 | |
61 | for (i = 0; i < KEYMAP_SIZE; i++) |
62 | { |
63 | keymap[i].type = ISFUNC; |
64 | keymap[i].function = (rl_command_func_t *)NULL; |
65 | } |
66 | |
67 | for (i = 'A'; i < ('Z' + 1); i++) |
68 | { |
69 | keymap[i].type = ISFUNC; |
70 | keymap[i].function = rl_do_lowercase_version; |
71 | } |
72 | |
73 | return (keymap); |
74 | } |
75 | |
76 | |
77 | Keymap |
78 | rl_copy_keymap (map) |
79 | Keymap map; |
80 | { |
81 | register int i; |
82 | Keymap temp = rl_make_bare_keymap (); |
83 | |
84 | for (i = 0; i < KEYMAP_SIZE; i++) |
85 | { |
86 | temp[i].type = map[i].type; |
87 | temp[i].function = map[i].function; |
88 | } |
89 | return (temp); |
90 | } |
91 | |
92 | |
93 | |
94 | |
95 | Keymap |
96 | rl_make_keymap () |
97 | { |
98 | register int i; |
99 | Keymap newmap; |
100 | |
101 | newmap = rl_make_bare_keymap (); |
102 | |
103 | |
104 | for (i = ' '; i < 127; i++) |
105 | newmap[i].function = rl_insert; |
106 | |
107 | newmap[TAB].function = rl_insert; |
108 | newmap[RUBOUT].function = rl_rubout; |
109 | newmap[CTRL('H')].function = rl_rubout; |
110 | |
111 | #if KEYMAP_SIZE > 128 |
112 | |
113 | for (i = 128; i < 160; i++) |
114 | newmap[i].function = rl_insert; |
115 | |
116 | |
117 | for (i = 160; i < 256; i++) |
118 | newmap[i].function = rl_insert; |
119 | #endif /* KEYMAP_SIZE > 128 */ |
120 | |
121 | return (newmap); |
122 | } |
123 | |
124 | |
125 | void |
126 | rl_discard_keymap (map) |
127 | Keymap map; |
128 | { |
129 | int i; |
130 | |
131 | if (!map) |
| 1 | Assuming 'map' is non-null | |
|
| |
132 | return; |
133 | |
134 | for (i = 0; i < KEYMAP_SIZE; i++) |
| 3 | | Loop condition is true. Entering loop body | |
|
135 | { |
136 | switch (map[i].type) |
| 4 | | Control jumps to 'case 2:' at line 145 | |
|
137 | { |
138 | case ISFUNC: |
139 | break; |
140 | |
141 | case ISKMAP: |
142 | rl_discard_keymap ((Keymap)map[i].function); |
143 | break; |
144 | |
145 | case ISMACR: |
146 | free ((char *)map[i].function); |
| 5 | | Argument to free() is a function pointer |
|
147 | break; |
148 | } |
149 | } |
150 | } |