From 50e84d8661b8485bd9f8ffed887a685303d5dada Mon Sep 17 00:00:00 2001 From: Jie Zhang Date: Fri, 1 Jul 2011 19:15:09 +0000 Subject: [PATCH] Avoid redundant initialization of hex table. * src/lib/hex.c (hex_init): Avoid redundant initialization. git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1950 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 2 ++ urjtag/src/lib/hex.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 2ec93196..ac37ee4b 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -13,6 +13,8 @@ * src/global/data_dir.c (make_relative_prefix): Don't declare. Include libiberty.h. + * src/lib/hex.c (hex_init): Avoid redundant initialization. + 2011-06-30 Mike Frysinger * cmd/cmd_initbus.c (cmd_initbus_complete): Complete bus parameters too. diff --git a/urjtag/src/lib/hex.c b/urjtag/src/lib/hex.c index 5eeafdbd..1f346f85 100644 --- a/urjtag/src/lib/hex.c +++ b/urjtag/src/lib/hex.c @@ -159,8 +159,14 @@ void hex_init (void) { #ifndef HEX_TABLE_INITIALIZED + static bool inited; int i; + if (inited) + return; + + inited = true; + for (i=0; i<_hex_array_size; i++) { switch (i)