VirtualBox

Changeset 107091 in vbox for trunk/include


Ignore:
Timestamp:
Nov 21, 2024 4:12:02 PM (6 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
166049
Message:

iprt/cdefs.h,SUPDrvIOC.h,VBoxGuestR0Lib: Added a RT_UOFFSETOF_FLEX_ARRAY macro for calculating the size of structures ending with an variables length arrays. Only tested on windows... bugref:10585

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cdefs.h

    r106565 r107091  
    29782978 * @param   type        Structure type.
    29792979 * @param   memberarray Member.
     2980 * @deprecated Use RT_UOFFSETOF_FLEX_ARRAY when possible.
    29802981 */
    29812982#if defined(__cplusplus) && RT_GNUC_PREREQ(4, 4)
     
    29842985# define RT_UOFFSETOF_DYN(type, memberarray)    ( (uintptr_t)&( ((type *)(void *)0)->memberarray) )
    29852986#endif
     2987
     2988/** @def RT_UOFFSETOF_FLEX_ARRAY
     2989 * Calculates the size of a structure that ends with a flexible array.
     2990 *
     2991 * @returns offset into the structure of the specified member. signed.
     2992 * @param   a_Type          Structure type.
     2993 * @param   a_ArrayMember   The name of flexible array member.
     2994 * @param   a_cEntries      The number of array entries to include in the
     2995 *                          offset.
     2996 */
     2997#define RT_UOFFSETOF_FLEX_ARRAY(a_Type, a_ArrayMember, a_cEntries) \
     2998        ( RT_UOFFSETOF(a_Type, a_ArrayMember) + RT_SIZEOFMEMB(a_Type, a_ArrayMember[0]) * (a_cEntries) )
    29862999
    29873000
Note: See TracChangeset for help on using the changeset viewer.

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