From 130ee2e521685ecf04664549591dd1037b781e9b Mon Sep 17 00:00:00 2001 From: dwheeler Date: Tue, 16 Jan 2007 14:35:52 +0000 Subject: [PATCH] Cleanup: Replaced initial tabs with spaces git-svn-id: svn+ssh://svn.code.sf.net/p/flawfinder/code/trunk@11 5c01084b-1f27-0410-9f85-80411afe95dc --- flawfinder | 100 ++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/flawfinder b/flawfinder index 19ade7a..c69fba0 100755 --- a/flawfinder +++ b/flawfinder @@ -195,33 +195,33 @@ def load_patch_info(patch_file): if (patch.has_key(patched_filename) == True): error("filename occurs more than once in the patch: %s" % patched_filename) - sys.exit(1) + sys.exit(1) else: patch[patched_filename] = {} else: hunk_match = diff_hunk.match(sLine) if (hunk_match): - if (patched_filename == ""): - error("wrong type of patch file : we have a line number without having seen a filename") - sys.exit(1) - initial_number= hunk_match.group('linenumber') - line_counter= 0 + if (patched_filename == ""): + error("wrong type of patch file : we have a line number without having seen a filename") + sys.exit(1) + initial_number= hunk_match.group('linenumber') + line_counter= 0 else: - line_added_match = diff_line_added.match(sLine) - if (line_added_match): - line_added = line_counter + int(initial_number) - patch[patched_filename][line_added] = True - # Let's also warn about the lines above and below this one, - # so that errors that "leak" into adjacent lines are caught. - # Besides, if you're creating a patch, you had to at least look - # at adjacent lines, so you're in a position to fix them. - patch[patched_filename][line_added - 1] = True - patch[patched_filename][line_added + 1] = True - line_counter += 1 - else: - line_del_match = diff_line_del.match(sLine) - if (line_del_match == None): - line_counter += 1 + line_added_match = diff_line_added.match(sLine) + if (line_added_match): + line_added = line_counter + int(initial_number) + patch[patched_filename][line_added] = True + # Let's also warn about the lines above and below this one, + # so that errors that "leak" into adjacent lines are caught. + # Besides, if you're creating a patch, you had to at least look + # at adjacent lines, so you're in a position to fix them. + patch[patched_filename][line_added - 1] = True + patch[patched_filename][line_added + 1] = True + line_counter += 1 + else: + line_del_match = diff_line_del.match(sLine) + if (line_del_match == None): + line_counter += 1 sLine = hPatch.readline() if (sLine == ''): break # Done reading. @@ -1348,24 +1348,24 @@ def process_c_file(f, patch_infos): word = text[startpos:endpos] # print "Word is:", text[startpos:endpos] if c_ruleset.has_key(word) and c_valid_match(text, endpos): - if ( (patch_infos == None) or ((patch_infos != None) and patch_infos[f].has_key(linenumber))): - # FOUND A MATCH, setup & call hook. - # print "HIT: #%s#\n" % word - # Don't use the tuple assignment form, e.g., a,b=c,d - # because Python (least 2.2.2) does that slower - # (presumably because it creates & destroys temporary tuples) - hit = Hit(c_ruleset[word]) - hit.name = word - hit.start = startpos - hit.end = endpos - hit.line = linenumber - hit.column = find_column(text, startpos) - hit.filename=filename - hit.context_text = get_context(text, startpos) - hit.parameters = extract_c_parameters(text, endpos) - if hit.extract_lookahead: - hit.lookahead = text[startpos:startpos+max_lookahead] - apply(hit.hook, (hit, )) + if ( (patch_infos == None) or ((patch_infos != None) and patch_infos[f].has_key(linenumber))): + # FOUND A MATCH, setup & call hook. + # print "HIT: #%s#\n" % word + # Don't use the tuple assignment form, e.g., a,b=c,d + # because Python (least 2.2.2) does that slower + # (presumably because it creates & destroys temporary tuples) + hit = Hit(c_ruleset[word]) + hit.name = word + hit.start = startpos + hit.end = endpos + hit.line = linenumber + hit.column = find_column(text, startpos) + hit.filename=filename + hit.context_text = get_context(text, startpos) + hit.parameters = extract_c_parameters(text, endpos) + if hit.extract_lookahead: + hit.lookahead = text[startpos:startpos+max_lookahead] + apply(hit.hook, (hit, )) elif p_digits.match(c): while i