mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
Pointed type is explicitly used with sizeof when dealing with struct pointers.
+review OPReview-474
This commit is contained in:
parent
88a39a81d8
commit
37eabb0931
@ -70,10 +70,10 @@ static struct pios_com_dev * PIOS_COM_alloc(void)
|
||||
{
|
||||
struct pios_com_dev * com_dev;
|
||||
|
||||
com_dev = (struct pios_com_dev *)pvPortMalloc(sizeof(*com_dev));
|
||||
com_dev = (struct pios_com_dev *)pvPortMalloc(sizeof(struct pios_com_dev));
|
||||
if (!com_dev) return (NULL);
|
||||
|
||||
memset(com_dev, 0, sizeof(*com_dev));
|
||||
memset(com_dev, 0, sizeof(struct pios_com_dev));
|
||||
com_dev->magic = PIOS_COM_DEV_MAGIC;
|
||||
return(com_dev);
|
||||
}
|
||||
@ -90,7 +90,7 @@ static struct pios_com_dev * PIOS_COM_alloc(void)
|
||||
|
||||
com_dev = &pios_com_devs[pios_com_num_devs++];
|
||||
|
||||
memset(com_dev, 0, sizeof(*com_dev));
|
||||
memset(com_dev, 0, sizeof(struct pios_com_dev));
|
||||
com_dev->magic = PIOS_COM_DEV_MAGIC;
|
||||
|
||||
return (com_dev);
|
||||
|
@ -75,10 +75,10 @@ static struct pios_usart_dev * PIOS_USART_alloc(void)
|
||||
{
|
||||
struct pios_usart_dev * usart_dev;
|
||||
|
||||
usart_dev = (struct pios_usart_dev *)pvPortMalloc(sizeof(*usart_dev));
|
||||
usart_dev = (struct pios_usart_dev *)pvPortMalloc(sizeof(struct pios_usart_dev));
|
||||
if (!usart_dev) return(NULL);
|
||||
|
||||
memset(usart_dev, 0, sizeof(*usart_dev));
|
||||
memset(usart_dev, 0, sizeof(struct pios_usart_dev));
|
||||
usart_dev->magic = PIOS_USART_DEV_MAGIC;
|
||||
return(usart_dev);
|
||||
}
|
||||
@ -95,7 +95,7 @@ static struct pios_usart_dev * PIOS_USART_alloc(void)
|
||||
|
||||
usart_dev = &pios_usart_devs[pios_usart_num_devs++];
|
||||
|
||||
memset(usart_dev, 0, sizeof(*usart_dev));
|
||||
memset(usart_dev, 0, sizeof(struct pios_usart_dev));
|
||||
usart_dev->magic = PIOS_USART_DEV_MAGIC;
|
||||
|
||||
return (usart_dev);
|
||||
|
@ -90,10 +90,10 @@ static struct pios_usb_cdc_dev * PIOS_USB_CDC_alloc(void)
|
||||
{
|
||||
struct pios_usb_cdc_dev * usb_cdc_dev;
|
||||
|
||||
usb_cdc_dev = (struct pios_usb_cdc_dev *)pvPortMalloc(sizeof(*usb_cdc_dev));
|
||||
usb_cdc_dev = (struct pios_usb_cdc_dev *)pvPortMalloc(sizeof(struct pios_usb_cdc_dev));
|
||||
if (!usb_cdc_dev) return(NULL);
|
||||
|
||||
memset(usb_cdc_dev, 0, sizeof(*usb_cdc_dev));
|
||||
memset(usb_cdc_dev, 0, sizeof(struct pios_usb_cdc_dev));
|
||||
usb_cdc_dev->magic = PIOS_USB_CDC_DEV_MAGIC;
|
||||
return(usb_cdc_dev);
|
||||
}
|
||||
@ -110,7 +110,7 @@ static struct pios_usb_cdc_dev * PIOS_USB_CDC_alloc(void)
|
||||
|
||||
usb_cdc_dev = &pios_usb_cdc_devs[pios_usb_cdc_num_devs++];
|
||||
|
||||
memset(usb_cdc_dev, 0, sizeof(*usb_cdc_dev));
|
||||
memset(usb_cdc_dev, 0, sizeof(struct pios_usb_cdc_dev));
|
||||
usb_cdc_dev->magic = PIOS_USB_CDC_DEV_MAGIC;
|
||||
|
||||
return (usb_cdc_dev);
|
||||
|
@ -84,10 +84,10 @@ static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void)
|
||||
{
|
||||
struct pios_usb_hid_dev * usb_hid_dev;
|
||||
|
||||
usb_hid_dev = (struct pios_usb_hid_dev *)pvPortMalloc(sizeof(*usb_hid_dev));
|
||||
usb_hid_dev = (struct pios_usb_hid_dev *)pvPortMalloc(sizeof(struct pios_usb_hid_dev));
|
||||
if (!usb_hid_dev) return(NULL);
|
||||
|
||||
memset(usb_hid_dev, 0, sizeof(*usb_hid_dev));
|
||||
memset(usb_hid_dev, 0, sizeof(struct pios_usb_hid_dev));
|
||||
usb_hid_dev->magic = PIOS_USB_HID_DEV_MAGIC;
|
||||
return(usb_hid_dev);
|
||||
}
|
||||
@ -104,7 +104,7 @@ static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void)
|
||||
|
||||
usb_hid_dev = &pios_usb_hid_devs[pios_usb_hid_num_devs++];
|
||||
|
||||
memset(usb_hid_dev, 0, sizeof(*usb_hid_dev));
|
||||
memset(usb_hid_dev, 0, sizeof(struct pios_usb_hid_dev));
|
||||
usb_hid_dev->magic = PIOS_USB_HID_DEV_MAGIC;
|
||||
|
||||
return (usb_hid_dev);
|
||||
|
@ -77,10 +77,10 @@ static struct pios_usart_dev * PIOS_USART_alloc(void)
|
||||
{
|
||||
struct pios_usart_dev * usart_dev;
|
||||
|
||||
usart_dev = (struct pios_usart_dev *)pvPortMalloc(sizeof(*usart_dev));
|
||||
usart_dev = (struct pios_usart_dev *)pvPortMalloc(sizeof(struct pios_usart_dev));
|
||||
if (!usart_dev) return(NULL);
|
||||
|
||||
memset(usart_dev, 0, sizeof(*usart_dev));
|
||||
memset(usart_dev, 0, sizeof(struct pios_usart_dev));
|
||||
usart_dev->magic = PIOS_USART_DEV_MAGIC;
|
||||
return(usart_dev);
|
||||
}
|
||||
@ -97,7 +97,7 @@ static struct pios_usart_dev * PIOS_USART_alloc(void)
|
||||
|
||||
usart_dev = &pios_usart_devs[pios_usart_num_devs++];
|
||||
|
||||
memset(usart_dev, 0, sizeof(*usart_dev));
|
||||
memset(usart_dev, 0, sizeof(struct pios_usart_dev));
|
||||
usart_dev->magic = PIOS_USART_DEV_MAGIC;
|
||||
|
||||
return (usart_dev);
|
||||
|
@ -103,10 +103,10 @@ static struct pios_usb_cdc_dev * PIOS_USB_CDC_alloc(void)
|
||||
{
|
||||
struct pios_usb_cdc_dev * usb_cdc_dev;
|
||||
|
||||
usb_cdc_dev = (struct pios_usb_cdc_dev *)pvPortMalloc(sizeof(*usb_cdc_dev));
|
||||
usb_cdc_dev = (struct pios_usb_cdc_dev *)pvPortMalloc(sizeof(struct pios_usb_cdc_dev));
|
||||
if (!usb_cdc_dev) return(NULL);
|
||||
|
||||
memset(usb_cdc_dev, 0, sizeof(*usb_cdc_dev));
|
||||
memset(usb_cdc_dev, 0, sizeof(struct pios_usb_cdc_dev));
|
||||
usb_cdc_dev->magic = PIOS_USB_CDC_DEV_MAGIC;
|
||||
return(usb_cdc_dev);
|
||||
}
|
||||
@ -123,7 +123,7 @@ static struct pios_usb_cdc_dev * PIOS_USB_CDC_alloc(void)
|
||||
|
||||
usb_cdc_dev = &pios_usb_cdc_devs[pios_usb_cdc_num_devs++];
|
||||
|
||||
memset(usb_cdc_dev, 0, sizeof(*usb_cdc_dev));
|
||||
memset(usb_cdc_dev, 0, sizeof(struct pios_usb_cdc_dev));
|
||||
usb_cdc_dev->magic = PIOS_USB_CDC_DEV_MAGIC;
|
||||
|
||||
return (usb_cdc_dev);
|
||||
|
@ -87,10 +87,10 @@ static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void)
|
||||
{
|
||||
struct pios_usb_hid_dev * usb_hid_dev;
|
||||
|
||||
usb_hid_dev = (struct pios_usb_hid_dev *)pvPortMalloc(sizeof(*usb_hid_dev));
|
||||
usb_hid_dev = (struct pios_usb_hid_dev *)pvPortMalloc(sizeof(struct pios_usb_hid_dev));
|
||||
if (!usb_hid_dev) return(NULL);
|
||||
|
||||
memset(usb_hid_dev, 0, sizeof(*usb_hid_dev));
|
||||
memset(usb_hid_dev, 0, sizeof(struct pios_usb_hid_dev));
|
||||
usb_hid_dev->magic = PIOS_USB_HID_DEV_MAGIC;
|
||||
return(usb_hid_dev);
|
||||
}
|
||||
@ -107,7 +107,7 @@ static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void)
|
||||
|
||||
usb_hid_dev = &pios_usb_hid_devs[pios_usb_hid_num_devs++];
|
||||
|
||||
memset(usb_hid_dev, 0, sizeof(*usb_hid_dev));
|
||||
memset(usb_hid_dev, 0, sizeof(struct pios_usb_hid_dev));
|
||||
usb_hid_dev->magic = PIOS_USB_HID_DEV_MAGIC;
|
||||
|
||||
return (usb_hid_dev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user