Enforce coding standard to start function { on new line.

Changes:

int foo(void) {

to:

int foo(void)
{

Replaces PR 889 (rebased by rerunning script).

Ran the python script below, which write the changed files into ./tmp.

./filter-functions.py .c *.h
mv ./tmp/ .

from sys import argv,stdout
from re import match
from re import search

def is_func(line):
if search('if|for|while|switch',line):
return 0
if search('[<!>]',line):
return 0
if search('->',line):
return 0
if search('&&',line):
return 0
if search('[|][|]',line):
return 0
if search('==',line):
return 0
if search('[)][)]',line):
return 0
if search('TAILQ_FOREACH',line):
return 0
if match('^[ \t]*[)]$',line):
return 0
if search('DETECT_CONTENT_FAST_PATTERN',line):
return 0

return 1

def process_file(fileanme):
f = open(filename)
fout = open("tmp/"+filename, "w")
for line in f.readlines():
m = match("^(.*)) *{[\n]?$",line)
if m and is_func(m.group(1)) == 1:
fout.write(m.group(1))
fout.write("\n{\n")
else:
fout.write(line)
f.close()
fout.close()

if name == "main":
for filename in argv[1:]:
print "Filtering", filename
process_file(filename)
Thanks. This was the second case not handled by the script.

From: Victor Julien [mailto:notifications@github.com]
Sent: Thursday, July 31, 2014 8:33 AM
To: inliniac/suricata
Cc: Kenneth Steele
Subject: Re: [suricata] Enforce coding standard to start function { on new line. (#1076)


In src/output.c:

>      OutputFileRolloverFlag *entry, *next;

>      for (entry = TAILQ_FIRST(&output_file_rotation_flags); entry != NULL;

> -         entry = next) {

> +         entry = next)

> +{

I fixed this one up.

—
Reply to this email directly or view it on GitHub<https://github.com/inliniac/suricata/pull/1076/files#r15639040>.