Change all Booleans to bool.
commitad5eb5a165442be38624aa622beeb57dc1d2afbd
authorRobert Spanton <rspanton@zepler.net>
Sat, 5 Jun 2010 02:55:54 +0000 (5 03:55 +0100)
committerDJ Delorie <dj@delorie.com>
Sat, 5 Jun 2010 03:34:41 +0000 (4 23:34 -0400)
tree05cb9deb03b6db173916c7cd2da65ade580f0f2f
parentfa761a714fc916db435d36e1f873a6fb1b8fb012
Change all Booleans to bool.

c99 provides bool.  Declaring Boolean adds some obscurity to the code,
and could also miss out on some machine-specific optimisations.

This patch removes the definition of Boolean, and changes all
instances of it to bool.

If you've come across this commit because it's causing you issues when
rebasing on mainline pcb, then you should find the following script
useful.  You can use it to rewrite all of your local commits to use
bool instead of Boolean like so:

git filter-branch --tree-filter rename-bool.sh HEAD...${HASH}

Replacing ${HASH} with the latest commit that's in mainline.

if [ ! -f src/autoplace.c ]
    then
    echo "This doesn't look like the PCB source directory."
    echo "Cowardly exiting to avoid causing misery!"
    exit
fi

chg_bool ()
{
    FNAME=$1
    ADDR=$2

    sed -i -e "${ADDR}s/\bBoolean\b/bool/g" "$FNAME"
    sed -i -e "${ADDR}s/\bTrue\b/true/g" "$FNAME"
    sed -i -e "${ADDR}s/\bFalse\b/false/g" "$FNAME"
}

find -name '*.[ch]' | while read f
do
    chg_bool "$f"
done

find -name '*.[yl]' | while read f
do
    # Replace first '%%' line with __TMP_MARKER_
    sed -i -e '0,/^%%/s/^%%/__TMP_MARKER_/' "$f"

    # Replace in section before the first '%%'
    chg_bool "$f" "0,/^__TMP_MARKER_/"
    # Replace in section after the last '%%'
    chg_bool "$f" "/^%%/,$"

    # Remove the temporary marker:
    sed -i -e 's/^__TMP_MARKER_/%%/' "$f"
done
87 files changed:
src/action.c
src/action.h
src/autoplace.c
src/autoplace.h
src/autoroute.c
src/autoroute.h
src/box.h
src/buffer.c
src/buffer.h
src/change.c
src/change.h
src/clip.c
src/clip.h
src/command.c
src/copy.c
src/copy.h
src/create.c
src/create.h
src/crosshair.c
src/crosshair.h
src/data.c
src/data.h
src/djopt.c
src/draw.c
src/draw.h
src/drill.c
src/file.c
src/file.h
src/find.c
src/find.h
src/flags.c
src/global.h
src/gts/gts.h
src/hid/gerber/gerber.c
src/hid/gtk/gui-command-window.c
src/hid/gtk/gui-dialog-size.c
src/hid/gtk/gui-drc-window.c
src/hid/gtk/gui-library-window.c
src/hid/gtk/gui-misc.c
src/hid/gtk/gui-netlist-window.c
src/hid/gtk/gui-output-events.c
src/hid/gtk/gui-top-window.c
src/hid/lesstif/dialogs.c
src/hid/lesstif/library.c
src/hid/lesstif/main.c
src/hid/lesstif/menu.c
src/hid/lesstif/netlist.c
src/hid/lesstif/styles.c
src/hid/nelma/nelma.c
src/insert.c
src/insert.h
src/line.c
src/main.c
src/misc.c
src/misc.h
src/move.c
src/move.h
src/mtspace.c
src/mtspace.h
src/mymem.c
src/netlist.c
src/parse_l.l
src/parse_y.y
src/polygon.c
src/polygon.h
src/polygon1.c
src/rats.c
src/rats.h
src/remove.c
src/remove.h
src/report.c
src/rotate.c
src/rtree.c
src/rtree.h
src/rubberband.c
src/search.c
src/search.h
src/select.c
src/select.h
src/set.c
src/set.h
src/thermal.c
src/toporouter.c
src/undo.c
src/undo.h
src/vendor.c
src/vendor.h