Skip to content

Commit

Permalink
change macros into functions; no measurable impact on speed, but smaller
Browse files Browse the repository at this point in the history
binary and easier to add checks for errors later
  • Loading branch information
ivop committed Jan 21, 2014
1 parent 7cee36e commit 14964ef
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions rkflashtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ static void send_cmd(uint32_t command, uint32_t offset, uint16_t nsectors) {
libusb_bulk_transfer(h, 2|LIBUSB_ENDPOINT_OUT, cmd, sizeof(cmd), &tmp, 0);
}

#define send_buf(s) libusb_bulk_transfer(h, 2|LIBUSB_ENDPOINT_OUT, \
buf, s, &tmp, 0)
static void send_buf(unsigned int s) {
libusb_bulk_transfer(h, 2|LIBUSB_ENDPOINT_OUT, buf, s, &tmp, 0);
}

#define recv_res() libusb_bulk_transfer(h, 1|LIBUSB_ENDPOINT_IN, \
res, sizeof(res), &tmp, 0)
static void recv_res(void) {
libusb_bulk_transfer(h, 1|LIBUSB_ENDPOINT_IN, res, sizeof(res), &tmp, 0);
}

#define recv_buf(s) libusb_bulk_transfer(h, 1|LIBUSB_ENDPOINT_IN, \
buf, s, &tmp, 0)
static void recv_buf(unsigned int s) {
libusb_bulk_transfer(h, 1|LIBUSB_ENDPOINT_IN, buf, s, &tmp, 0);
}

#define NEXT do { argc--;argv++; }while(0)

Expand Down

0 comments on commit 14964ef

Please sign in to comment.