Here is another idea for a contribution - refactoring.

Currently there are a lot of procedures in PostgreSQL code that
definitely don't fit on one screen (i.e. ~50 lines). Also many files are
larger than say 1000 lines of code. For instance, psql_completion
procedure is more than 2000 lines long! I think patches that would make
such code easier to read would have a good chance to be accepted.

In case you are interested I wrote a script that scans PostgreSQL code
and then prints procedures names and corresponding number of lines of
code (see attachment).

-- 
Best regards,
Aleksander Alekseev
#!/usr/bin/env python3

import sys
import os
import re

def process_file(fname):
	nlines = 0
	procname = ""
	with open(fname) as f:
		for line in f:
			nlines += 1
			if re.search("^{", line):
				nlines = 0
			elif re.search("^}", line) and procname and (nlines > 0):
				print("{:08d}:{}".format(nlines-1, procname))
				procname = ""
			else:
				m = re.search("^(\\w+)\\s*\\(", line)
				if m:
					procname = m.group(1)

def recursive_search(path):
	for file in os.listdir(path):
		if (file == ".") or (file == ".."):
			continue

		full_name = os.path.join(path, file)
		if not os.path.islink(full_name):
			if os.path.isdir(full_name):
				recursive_search(full_name)

			if re.search("\\.c$", file):
				process_file(full_name)

if len(sys.argv) < 2:
	print("Usage " + sys.argv[0] + " <path>")
	sys.exit(1)

start_path = sys.argv[1]
recursive_search(start_path)
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to