- Add static inline jtag_error_clear helper to return and clear jtag_error.
- Use new helper to shrink body of function to two lines.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2117
b42882b7-edfa-0310-969c-
e2dbd0fdcd60
int jtag_execute_queue(void)
{
- int retval;
jtag_execute_queue_noclear();
- retval=jtag_error;
- jtag_error=ERROR_OK;
- return retval;
+ return jtag_error_clear();
}
static int jtag_reset_callback(enum jtag_event event, void *priv)
jtag_error=error;
}
-
+/**
+ * Resets jtag_error to ERROR_OK, returning its previous value.
+ * @returns The previous value of @c jtag_error.
+ */
+static inline int jtag_error_clear(void)
+{
+ int temp = jtag_error;
+ jtag_error = ERROR_OK;
+ return temp;
+}
/* can be implemented by hw+sw */
extern int jtag_power_dropout(int* dropout);