source: trunk/tools/quality @ 120

Last change on this file since 120 was 120, checked in by bcornec, 14 years ago

libmondo-filelist.c memory review (asprintf and the like) - compiles but no test made yet

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/bin/bash
2#
3# $Id$
4#
5# Mesures quality improvement of mondorescue project
6#
7
8# Adapt to your needs
9dname=`dirname $0`
10prem=`echo $dname |cut -c1`
11if [ ${prem} == "/" ]; then
12        export TOOLHOME=$dname
13else
14        export TOOLHOME=${PWD}/$dname
15fi
16
17d=$TOOLHOME/..
18
19if [ $# -gt 0 ]; then
20    if [ -d $1 ]; then
21        d=$1
22    fi
23fi
24
25echo "Working on $d"
26echo " "
27cd $d
28
29# How many sprintf/strcat/strcpy vs asprintf are they
30echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r asprintf | wc -l` asprintf"
31echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r sprintf | grep -v asprintf | wc -l` sprintf"
32echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r strcat | wc -l` strcat"
33echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r strcpy | wc -l` strcpy"
34echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r fgets | wc -l` fgets"
35echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r malloc_string | wc -l` malloc_string"
36echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r MAX_STR_LEN | wc -l` MAX_STR_LEN"
37echo "monodrescue uses : `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | egrep -v '/\*' | xargs grep -r goto | wc -l` goto"
38
39echo " "
40echo "Qualimetry: "
41find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | xargs grep -r asprintf | egrep -v '/\*' | egrep -v 'asprintf\(&' > /tmp/mondo.quality
42cat /tmp/mondo.quality
43echo "monodrescue uses : `cat /tmp/mondo.quality | wc -l` asprintf without &"
44find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | xargs grep -r getline | egrep -v '/\*' | egrep -v 'getline\(&' > /tmp/mondo.quality
45cat /tmp/mondo.quality
46echo "monodrescue uses : `cat /tmp/mondo.quality | wc -l` getline without &"
47
48echo " "
49echo "Splint: "
50find . -name '*.c' -o -name '*.h' | xargs splint +posixlib -Dlinux
51
52rm -f /tmp/mondo.quality
Note: See TracBrowser for help on using the repository browser.