1#!/bin/sh
2#
3# This is a small script which counts the number of db_lock and db_unlocks are
4# used in the code. With the current coding standard you should have exactly
5# the same number of db_lock and db_unlock calls.
6#
7if [ $# -gt 0 ]; then
8   files="$*"
9else
10   files=`ls -1 *.c`
11fi
12
13for file in ${files}
14do
15   nr_locks=`grep -c ' db_lock(' ${file}`
16   nr_unlocks=`grep -c ' db_unlock(' ${file}`
17   if [ ${nr_locks} -gt 0 ]; then
18      if [ ${nr_locks} != ${nr_unlocks} ]; then
19         echo "${file} ==> ${nr_locks} db_locks and ${nr_unlocks} db_unlocks !!!"
20      fi
21   fi
22done
23