Task of comparing two .c files which has function definitions from other files generated via different sources


New Member
Jan 30, 2023
Reaction score
Hello, Here is my plan to compare the function bodys from both files:
I am writing a shell script to do the following:
- list all .c and .cpp files.
- loop through .c and .cpp to extract function definitions only.
- store function definitions in separate file named as function_name.c.
Now writing a python script to execute shell script to do the following
- Add function definitions as a entry to nested dictionary(hash table)in below format.
file_details={'file1':{'functionName1':'fxn_body1', \
'functionName2':'fxn_body2', \
'functionName3':'fxn_body3'}, \
'file2':{'functionName1':'fxn_body1', \
'functionName2':'fxn_body2', \
'functionName3':'fxn_body3'}, \
'file3':{'functionName1':'fxn_body1', \
'functionName2':'fxn_body2', \
'functionName3':'fxn_body3'}, }
and so on.

I have this work ready but its taking too much time I have around 3k files to apply these operations
I am using lot of awk commands in shell script to achieve this.
Any suggestions to reduce time would be helpful.
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online

Latest posts