Finding orphaned functions
Matt Bosworth <[email protected]>
| Newsgroups | gmane.comp.gnu.global.general |
|---|---|
| Message-ID | <[email protected]> |
Hello -- I'm managing a medium sized coding project, and in the course of some changes certain functions were orphaned. That is, they exist in the code, but are never referenced. Being a little anal, I'd like to try to find and remove these functions. It occurs to me that other people have had this problem and might have a more elegant solution than this : cd <projRoot> global -x '*' > functions.list foreach line in (`cat functions.list | cut -f1`) do response=global -rx $line #Assumes global returns failure if it can't find a reference?? if [ $response -ne 0 ]; then echo $line >> orphanedFiles fi done (pardon any syntax errors, I haven't actually run this anywhere...) Is this sort of approach my best bet? Is there a better way? Thanks in advance, Matt Bosworth