]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'martin-t/unused_fields' into 'master'
authorMario <zacjardine@y7mail.com>
Fri, 21 Oct 2016 01:17:03 +0000 (01:17 +0000)
committerMario <zacjardine@y7mail.com>
Fri, 21 Oct 2016 01:17:03 +0000 (01:17 +0000)
Martin t/unused fields

I was playing with grep&friends and decided to see if I could remove some unused fields from the code. I actually expected to find a lot more and only removed a few of those anyway because sometimes I wasn't sure if it's safe to remove them and didn't wanna spend too much time on it.

If anybody wants to go more in-depth, I'll leave the ipython script here as inspiration

```
#!/usr/bin/env ipython3

fields = !find . -type f -name '*.q*' -print0 | xargs -0 grep -hoP '^[[:space:]]*\.[a-zA-Z1-9_]+ [a-zA-Z1-9_]+(, [a-zA-Z1-9_]+)*;' | awk '{$1 = ""; print}' | tr ',' '\n' | tr -d " ;"

fields = set(fields)
fields = sorted(fields)

for field in fields:
    ret = !find . -type f -name '*.q*' -print0 | xargs -0 grep -P '\.$field[^a-zA-Z1-9_]?'
    if len(ret) <= 1:
        print(field + " " + str(len(ret)))
```

See merge request !378

1  2 
qcsrc/common/monsters/monster.qh

Simple merge