Mercurial > pidgin
view fix-casts.sh @ 27454:1b580473e753
Check in a version of jabber_id_new() that is hopefully more efficient.
I think it's less efficient than the version I originally sent to the
devel list and accidentally checked in a day or three ago.
But it's also correct, and passes all our unit tests. I think it can
be optimized a little further by filling in characters in the default case
of the switch statement (see "implement_me") and remove the #if 0 lines.
It's ok if the "implement_me" checks don't list every valid character--
the worst that happens is the check falls through to our nodeprep and
resource prep.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 10 Jul 2009 06:37:13 +0000 |
parents | c3ca613ab550 |
children |
line wrap: on
line source
#!/bin/sh if [ $# -eq 0 ]; then echo "Usage: `basename "$0"` PurpleFoo..." echo echo "This script searches the *current working directory* and replaces casts" echo "with GObject-style type checking and casting macros." echo 'For example, "(PurpleBuddy *)b" becomes "PURPLE_BUDDY(b)".' exit 0 fi for struct in $* ; do cast=`echo $struct | sed "s|[A-Z]|_\0|g" | tr "a-z" "A-Z" | sed "s|^_||"` for file in `grep -rl "([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)" . --include=*.c --exclude=purple-client-bindings.c` ; do sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*(|$cast(|g" $file sed -i "s|([[:space:]]*$struct[[:space:]]*\*[[:space:]]*)[[:space:]]*\([^(][^,);]*\)|$cast(\1)|g" $file done done