transport: fix LOG_DEBUG gaffe
authorsimon qian <simonqian.openocd@gmail.com>
Thu, 13 Jan 2011 07:25:22 +0000 (08:25 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Thu, 13 Jan 2011 07:28:29 +0000 (08:28 +0100)
LOG_DEBUG() arguments are only evaluated when DEBUG logging
is enabled, do not use arguments that have side effects
like foo++.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/jtag/transport.c

index 5033ebc6df4a8ce498f6c79d4f781bef131c98f6..f570103cc7df2f84b4221bbd2a2a82f32a6817fe 100644 (file)
@@ -125,8 +125,10 @@ int allow_transports(struct command_context *ctx, const char **vector)
        } else {
                /* guard against user config errors */
                LOG_WARNING("must select a transport.");
-               while (*vector)
-                       LOG_DEBUG("allow transport '%s'", *vector++);
+               while (*vector) {
+                       LOG_DEBUG("allow transport '%s'", *vector);
+                       vector++;
+               }
                return ERROR_OK;
        }
 }