summaryrefslogtreecommitdiffstats
path: root/firmware/usbstack/usb_class_driver.h
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2011-12-29 21:58:34 +0000
committerRafaël Carré <rafael.carre@gmail.com>2011-12-29 21:58:34 +0000
commit4c2126b5a8b0bea04d4c5ba8bee032f9bc0efbe0 (patch)
treee98a32588e3919908590b3c9ddac89dbc24caea3 /firmware/usbstack/usb_class_driver.h
parent6a6269ffd8dfaf921588bae47cd55716abb78abb (diff)
downloadrockbox-4c2126b5a8b0bea04d4c5ba8bee032f9bc0efbe0.tar.gz
rockbox-4c2126b5a8b0bea04d4c5ba8bee032f9bc0efbe0.tar.bz2
rockbox-4c2126b5a8b0bea04d4c5ba8bee032f9bc0efbe0.zip
usb PACK_DATA: use a static inline to enable type checking
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31467 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/usbstack/usb_class_driver.h')
-rw-r--r--firmware/usbstack/usb_class_driver.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/firmware/usbstack/usb_class_driver.h b/firmware/usbstack/usb_class_driver.h
index c8d1e7047d..20ee26a3d0 100644
--- a/firmware/usbstack/usb_class_driver.h
+++ b/firmware/usbstack/usb_class_driver.h
@@ -85,10 +85,10 @@ struct usb_class_driver {
#endif
};
-#define PACK_DATA(dest, data) \
- do { \
- memcpy(dest, &(data), sizeof(data)); \
- dest += sizeof(data); \
- } while (0)
-
+#define PACK_DATA(dest, data) pack_data(dest, &(data), sizeof(data))
+static inline void pack_data(uint8_t **dest, const void *data, size_t size)
+{
+ memcpy(*dest, data, size);
+ *dest += size;
+}
#endif