[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding orphaned functions

From: Matt Bosworth
Subject: Finding orphaned functions
Date: Thu, 14 Apr 2005 19:51:11 -0700

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

(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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]