VirtualBox

Ignore:
Timestamp:
Aug 10, 2007 9:13:38 AM (17 years ago)
Author:
vboxsync
Message:

Use alloca instead of wasting 1k/2k of kernel stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/HGCMInternal.cpp

    r4071 r4105  
    2424#include <iprt/string.h>
    2525#include <iprt/assert.h>
     26#include <iprt/alloca.h>
    2627
    2728/* These functions can be only used by VBoxGuest. */
     
    128129
    129130    if (!pCallInfo || !pAsyncCallback || pCallInfo->cParms > VBOX_HGCM_MAX_PARMS)
     131    {
     132        AssertFailed();
    130133        return VERR_INVALID_PARAMETER;
     134    }
    131135
    132136    dprintf (("VbglHGCMCall: pCallInfo->cParms = %d, pHGCMCall->u32Function = %d\n", pCallInfo->cParms, pCallInfo->u32Function));
     
    143147    if (VBOX_SUCCESS(rc))
    144148    {
    145         void *apvCtx[VBOX_HGCM_MAX_PARMS];
    146         memset (apvCtx, 0, sizeof (apvCtx));
     149        void **apvCtx = (void **)alloca(sizeof(void *) * pCallInfo->cParms);
     150        memset (apvCtx, 0, sizeof(void *) * pCallInfo->cParms);
    147151
    148152        /* Initialize request memory */
     
    251255                }
    252256            }
     257            else
     258                Assert(!apvCtx[iParm]);
    253259        }
    254260
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette