summaryrefslogtreecommitdiff
path: root/new/leaks.awk
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-04-16 20:33:28 -0400
committerPietro Gagliardi <[email protected]>2015-04-16 20:33:28 -0400
commite34c561ed5bedeb180437ec165882b98d70d38c1 (patch)
treed095e5db16d7a23e883526c8c1d3c524639c97cf /new/leaks.awk
parentde9d72299fb89a8b6cdc8963cd6b6ae708a81e80 (diff)
Split the rewrite into a new repository.
Diffstat (limited to 'new/leaks.awk')
-rw-r--r--new/leaks.awk56
1 files changed, 0 insertions, 56 deletions
diff --git a/new/leaks.awk b/new/leaks.awk
deleted file mode 100644
index 1d19ea8..0000000
--- a/new/leaks.awk
+++ /dev/null
@@ -1,56 +0,0 @@
-# 7 april 2015
-
-$2 == "alloc" {
- if ($1 in A) {
- problem($1 " already allocated (" A[$1] "); allocated at " NR)
- next
- }
- A[$1] = type()
- next
-}
-
-$2 == "realloc" {
- if (!($1 in A)) {
- problem($1 " not yet allocated; reallocated at " NR)
- next
- }
- if ($3 in A) {
- problem($3 " already allocated (" A[$3] "); reallocated at " NR)
- next
- }
- t = A[$1]
- delete A[$1]
- A[$3] = t
- next
-}
-
-$2 == "free" {
- if (!($1 in A)) {
- problem($1 " not yet allocated; freed at " NR)
- next
- }
- delete A[$1]
- next
-}
-
-{ problem("unrecognized line " $0 " at " NR) }
-
-END {
- for (i in A)
- problem("leaked " A[i] " at " i)
- close("/dev/stderr")
- if (hasProblems)
- exit 1
-}
-
-function problem(s) {
- print s > "/dev/stderr"
- hasProblems = 1
-}
-
-function type( s, i) {
- s = $3
- for (i = 4; i <= NF; i++)
- s = s " " $i
- return s
-}