(cfg, functionName, nonnull)
| 5 | |
| 6 | |
| 7 | def 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 | |
| 35 | def parseheader(cppcheckpath, filename): |
no test coverage detected