source: MondoRescue/trunk/tools/quality @ 900

Last change on this file since 900 was 900, checked in by Bruno Cornec, 14 years ago

Huge patch to introduce low level functions that will bw used everywhere (mr_free, mr_asprintf, ...)
Nearly linking now due to that.

  • Property svn:executable set to *
File size: 1.4 KB
RevLine 
[119]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
[900]30for s in asprintf mr_asprintf sprintf strcat strcpy strncpy fgets malloc mr_malloc malloc_string getline mr_getline MAX_STR_LEN getcwd goto free mr_free; do
[121]31    echo "monodrescue $s usage : "
[688]32    tot=0
33    for i in `find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn|/\*|monitas' | xargs grep -r -c -w $s | egrep -v ":0$"`; do
[121]34            echo " === $i"
[688]35            ((tot=$tot+`echo $i | cut -d: -f2`))
[121]36    done
[688]37    echo "total $s usage : $tot"
[121]38done
[119]39
40echo " "
41echo "Qualimetry: "
42find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | xargs grep -r asprintf | egrep -v '/\*' | egrep -v 'asprintf\(&' > /tmp/mondo.quality
43cat /tmp/mondo.quality
44echo "monodrescue uses : `cat /tmp/mondo.quality | wc -l` asprintf without &"
45find . -name '*.c' -o -name '*.h' |  egrep -v '\.svn' | xargs grep -r getline | egrep -v '/\*' | egrep -v 'getline\(&' > /tmp/mondo.quality
46cat /tmp/mondo.quality
47echo "monodrescue uses : `cat /tmp/mondo.quality | wc -l` getline without &"
48
49echo " "
50echo "Splint: "
[146]51find . -name '*.c' -o -name '*.h' | xargs splint +posixlib -Dlinux
[119]52
53rm -f /tmp/mondo.quality
Note: See TracBrowser for help on using the repository browser.