script for quickly finding large functions

Joris Huizer jorishuizer at planet.nl
Fri Apr 15 11:34:55 CDT 2005


Hello,

I made this script to find large functions; I think it may be usefull to 
add at the janitorial page where the note on large functions was placed;

It assumes no things are between functions, so it gives some incorrect 
matches; also, it accidentilly reads some if() and switch() statements, 
but in some (most) cases those are actually in large functions if they 
show up high.

I hope this is usefull, it did find some interesting large functions 
like HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load 
(dlls/dmloader/container.c) which has like 7 levels of nested switch 
statements

regards,

Joris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getsize2.sh
Type: application/x-shellscript
Size: 629 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050415/caee63da/getsize2.bin
-------------- next part --------------
BEGIN {line_no = 0; file="";}
{
  if ($1 != file)
  {
    if (line_no != 0 && index(file,".c") != 0) 
    {
      printf("?: %s %s\n",file,var); 
    }
    line_no = 0;
    file = $1
  }

  if (line_no != 0 && index(file,".c") != 0) 
  {
    printf("%6d: %s %s\n",($2 - line_no),file,var); 
  }
  line_no = $2 
  
  var = "";
  for (i = 3; i <= NF; i++)
  {
    var = sprintf("%s%s ",var,$i);
  }
}


More information about the wine-devel mailing list