src/components/rocm_smi/linux-rocm-smi.c
static void MakeRoomScanEvents(void)
{
    if (TotalScanEvents < SizeScanEvents) return;       // One more will fit.
    if (ScanEvents == NULL) {                           // Never alloced;
        SizeScanEvents = 16;                            // Begin with 16 entries,
        ScanEvents = calloc(SizeScanEvents, sizeof(scanEvent_info_t));
        return;
    }

    // Must add 16 table entries.
    SizeScanEvents += 16;                                                       // Add 16 entries.
    ScanEvents = realloc(ScanEvents, SizeScanEvents*sizeof(scanEvent_info_t));  // make more room.
    memset(&ScanEvents[SizeScanEvents-16], 0, 16*sizeof(scanEvent_info_t));     // clear the added room.
}
//----------------------------------------------------------------------------
// Ensures there is room in scanEvents for one more entry.
// Note we always zero added space as the default if any elements are not set.
//----------------------------------------------------------------------------
Ensures there is room in scanEvents for one more entry.
Note we always zero added space as the default if any elements are not set.
Ensures there is room in scanEvents for one more entry . Note we always zero added space as the default if any elements are not set .
static void MakeRoomScanEvents(void)
{
    if (TotalScanEvents < SizeScanEvents) return;       
    if (ScanEvents == NULL) {                           
        SizeScanEvents = 16;                            
        ScanEvents = calloc(SizeScanEvents, sizeof(scanEvent_info_t));
        return;
    }
    SizeScanEvents += 16;                                                       
    ScanEvents = realloc(ScanEvents, SizeScanEvents*sizeof(scanEvent_info_t));  
    memset(&ScanEvents[SizeScanEvents-16], 0, 16*sizeof(scanEvent_info_t));     
}
static void MakeRoomScanEvents ( void ) { if ( TotalScanEvents < SizeScanEvents ) return ; if ( ScanEvents == NULL ) { SizeScanEvents = 16 ; ScanEvents = calloc ( SizeScanEvents , sizeof ( scanEvent_info_t ) ) ; return ; } SizeScanEvents += 16 ; ScanEvents = realloc ( ScanEvents , SizeScanEvents * sizeof ( scanEvent_info_t ) ) ; memset ( & ScanEvents [ SizeScanEvents - 16 ] , 0 , 16 * sizeof ( scanEvent_info_t ) ) ; }
Ensures there is room in scanEvents for one more entry.
Ensures there is room in scanEvents for one more entry .
// One more will fit. // Never alloced; // Begin with 16 entries, // Must add 16 table entries. // Add 16 entries. // make more room. // clear the added room.