videoeditorengine/h263decoder/inc/stckheap.h
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:  
       
    16 * Macros for stack/heap allocation.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef _STCKHEAP_H_
       
    22 #define _STCKHEAP_H_
       
    23 
       
    24 /*
       
    25  * Include files
       
    26  */
       
    27 
       
    28 
       
    29 /*
       
    30  * Internal macros
       
    31  * (Not supposed to be used in any other file)
       
    32  */
       
    33 
       
    34 /* Concatenates two strings */
       
    35 #define SOH_CAT_STRINGS(item1, item2) item1 ## item2
       
    36 
       
    37 /* Concatenates two macros */
       
    38 #define SOH_CAT_MACROS(macro1, macro2) SOH_CAT_STRINGS(macro1, macro2)
       
    39 
       
    40 
       
    41 /* 
       
    42  * Public macros
       
    43  */
       
    44 
       
    45 /*
       
    46  * SOH_DEFINE
       
    47  *
       
    48  * Parameters:
       
    49  *    type_t                     type name
       
    50  *    varName                    variable name
       
    51  *
       
    52  * Function:
       
    53  *    This macro defines a variable called varName of type type_t *.
       
    54  *
       
    55  * Example:
       
    56  *    SOH_DEFINE(int, pValue); defines a variable called pValue of type int *.
       
    57  */
       
    58 
       
    59 /*
       
    60  * SOH_ALLOC
       
    61  *
       
    62  * Parameters:
       
    63  *    type_t                     type name
       
    64  *    varName                    variable name
       
    65  *
       
    66  * Function:
       
    67  *    This macro allocates and initializes a variable previously created
       
    68  *    with SOH_DEFINE.
       
    69  *
       
    70  * Example:
       
    71  *    SOH_ALLOC(int, pValue); allocates an int variable and sets pValue to
       
    72  *    point to it.
       
    73  */
       
    74 
       
    75 /*
       
    76  * SOH_DEALLOC
       
    77  *
       
    78  * Parameters:
       
    79  *    varName                    variable name
       
    80  *
       
    81  * Function:
       
    82  *    This macro deallocates a variable previously created
       
    83  *    with SOH_DEFINE and SOH_ALLOC.
       
    84  *
       
    85  * Example:
       
    86  *    SOH_DEALLOC(pValue); deallocates pValue.
       
    87  */
       
    88 
       
    89 
       
    90 /* Set the pointer to NULL in order to allow safe usage of SOH_DEALLOC
       
    91    without a call to SOH_ALLOC first. */
       
    92 #define SOH_DEFINE(type_t, varName) \
       
    93    type_t *varName = NULL
       
    94   
       
    95 #define SOH_ALLOC(type_t, varName) \
       
    96    varName = (type_t *) malloc(sizeof(type_t))
       
    97    
       
    98 #define SOH_DEALLOC(varName) \
       
    99    free(varName)
       
   100 
       
   101 
       
   102 #endif
       
   103 // End of File