MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / checknonnull

Function checknonnull

tools/parse-glibc.py:7–32  ·  view source on GitHub ↗
(cfg, functionName, nonnull)

Source from the content-addressed store, hash-verified

5
6
7def checknonnull(cfg, functionName, nonnull):
8 pos1 = cfg.find('<function name="' + functionName + '">')
9 if pos1 < 0:
10 return
11 pos2 = cfg.find('</function>', pos1)
12 if pos2 < 0:
13 return
14 functionCfg = cfg[pos1:pos2]
15 s = None
16 for argnr in range(10):
17 argpos1 = functionCfg.find('<arg nr="' + str(argnr) + '">')
18 if argpos1 < 0:
19 continue
20 argpos2 = functionCfg.find('</arg>', argpos1)
21 notnullpos = functionCfg.find('not-null', argpos1)
22 if 0 <= notnullpos < argpos2:
23 if s:
24 s += ', ' + str(argnr)
25 else:
26 s = str(argnr)
27 if s != nonnull:
28 if not nonnull:
29 nonnull = ''
30 if not s:
31 s = ''
32 print(functionName + '\tglibc:' + nonnull + '\tcfg:' + s)
33
34
35def parseheader(cppcheckpath, filename):

Callers 1

parseheaderFunction · 0.85

Calls 2

strFunction · 0.85
findMethod · 0.45

Tested by

no test coverage detected