Skip to content

Commit

Permalink
Merge pull request #5690 from neheb/bzero
Browse files Browse the repository at this point in the history
treewide: Replace bzero with memset
  • Loading branch information
michaelrsweet authored Mar 11, 2021
2 parents 82e3ee0 + 0439a9c commit b27a49b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions backend/usb-darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer,
/* This request takes the 0 based configuration index. IOKit returns a 1 based configuration index */
configurationIndex -= 1;

bzero(&request, sizeof(request));
memset(&request, 0, sizeof(request));

request.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBClass, kUSBInterface);
request.bRequest = kUSBPrintClassGetDeviceID;
Expand Down Expand Up @@ -1638,7 +1638,7 @@ static CFStringRef copy_printer_interface_deviceid(printer_interface_t printer,
IOUSBDevRequestTO request;
IOUSBDeviceDescriptor desc;

bzero(&request, sizeof(request));
memset(&request, 0, sizeof(request));

request.bmRequestType = USBmakebmRequestType( kUSBIn, kUSBStandard, kUSBDevice );
request.bRequest = kUSBRqGetDescriptor;
Expand Down Expand Up @@ -1728,7 +1728,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_
UInt8 description[256]; // Max possible descriptor length
IOUSBDevRequestTO request;

bzero(description, 2);
memset(description, 0, 2);

request.bmRequestType = USBmakebmRequestType(kUSBIn, kUSBStandard, kUSBDevice);
request.bRequest = kUSBRqGetDescriptor;
Expand All @@ -1742,7 +1742,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_
err = (*printer)->ControlRequestTO(printer, 0, &request);
if (err != kIOReturnSuccess && err != kIOReturnOverrun)
{
bzero(description, request.wLength);
memset(description, 0, request.wLength);

// Let's try again full length. Here's why:
// On USB 2.0 controllers, we will not get an overrun error. We just get a "babble" error
Expand Down Expand Up @@ -1775,7 +1775,7 @@ static CFStringRef copy_printer_interface_indexed_description(printer_interface_
request.wValue = (kUSBStringDesc << 8) | index;
request.wIndex = language;

bzero(description, length);
memset(description, 0, length);
request.wLength = (UInt16)length;
request.pData = &description;
request.completionTimeout = 0;
Expand Down
6 changes: 3 additions & 3 deletions scheduler/sysman.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ sysEventThreadEntry(void)
* Register for power state change notifications
*/

bzero(&threadData, sizeof(threadData));
memset(&threadData, 0, sizeof(threadData));

threadData.sysevent.powerKernelPort =
IORegisterForSystemPower(&threadData, &powerNotifierPort,
Expand All @@ -441,7 +441,7 @@ sysEventThreadEntry(void)
* Register for system configuration change notifications
*/

bzero(&storeContext, sizeof(storeContext));
memset(&storeContext, 0, sizeof(storeContext));
storeContext.info = &threadData;

store = SCDynamicStoreCreate(kCFAllocatorDefault, CFSTR("cupsd"),
Expand Down Expand Up @@ -536,7 +536,7 @@ sysEventThreadEntry(void)
* this later.
*/

bzero(&timerContext, sizeof(timerContext));
memset(&timerContext, 0, sizeof(timerContext));
timerContext.info = &threadData;

threadData.timerRef =
Expand Down

0 comments on commit b27a49b

Please sign in to comment.