openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libnl/1_3.4.0-r0/build/lib/route/pktloc_grammar.c
static void pktloc_ensure_buffer_stack(yyscan_t yyscanner)
{
    yy_size_t num_to_alloc;
    struct yyguts_t* yyg = (struct yyguts_t*)yyscanner;

    if (!yyg->yy_buffer_stack)
    {

        /* First allocation is just for 2 elements, since we don't know if this
         * scanner will even need a stack. We use 2 instead of 1 to avoid an
         * immediate realloc on the next call.
         */
        num_to_alloc =
            1; /* After all that talk, this was set to 1 anyways... */
        yyg->yy_buffer_stack = (struct yy_buffer_state**)pktloc_alloc(
            num_to_alloc * sizeof(struct yy_buffer_state*), yyscanner);
        if (!yyg->yy_buffer_stack)
            YY_FATAL_ERROR(
                "out of dynamic memory in pktloc_ensure_buffer_stack()");

        memset(yyg->yy_buffer_stack, 0,
               num_to_alloc * sizeof(struct yy_buffer_state*));

        yyg->yy_buffer_stack_max = num_to_alloc;
        yyg->yy_buffer_stack_top = 0;
        return;
    }

    if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1)
    {

        /* Increase the buffer to prepare for a possible push. */
        yy_size_t grow_size = 8 /* arbitrary grow size */;

        num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
        yyg->yy_buffer_stack = (struct yy_buffer_state**)pktloc_realloc(
            yyg->yy_buffer_stack,
            num_to_alloc * sizeof(struct yy_buffer_state*), yyscanner);
        if (!yyg->yy_buffer_stack)
            YY_FATAL_ERROR(
                "out of dynamic memory in pktloc_ensure_buffer_stack()");

        /* zero only the new slots.*/
        memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0,
               grow_size * sizeof(struct yy_buffer_state*));
        yyg->yy_buffer_stack_max = num_to_alloc;
    }
}
/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
Allocates the stack if it does not exist.
Guarantees space for at least one push.
Allocates the stack if it does not exist . Guarantees space for at least one push .
static void pktloc_ensure_buffer_stack(yyscan_t yyscanner)
{
    yy_size_t num_to_alloc;
    struct yyguts_t* yyg = (struct yyguts_t*)yyscanner;
    if (!yyg->yy_buffer_stack)
    {
        num_to_alloc =
            1; 
        yyg->yy_buffer_stack = (struct yy_buffer_state**)pktloc_alloc(
            num_to_alloc * sizeof(struct yy_buffer_state*), yyscanner);
        if (!yyg->yy_buffer_stack)
            YY_FATAL_ERROR(
                "out of dynamic memory in pktloc_ensure_buffer_stack()");
        memset(yyg->yy_buffer_stack, 0,
               num_to_alloc * sizeof(struct yy_buffer_state*));
        yyg->yy_buffer_stack_max = num_to_alloc;
        yyg->yy_buffer_stack_top = 0;
        return;
    }
    if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1)
    {
        yy_size_t grow_size = 8 ;
        num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
        yyg->yy_buffer_stack = (struct yy_buffer_state**)pktloc_realloc(
            yyg->yy_buffer_stack,
            num_to_alloc * sizeof(struct yy_buffer_state*), yyscanner);
        if (!yyg->yy_buffer_stack)
            YY_FATAL_ERROR(
                "out of dynamic memory in pktloc_ensure_buffer_stack()");
        memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0,
               grow_size * sizeof(struct yy_buffer_state*));
        yyg->yy_buffer_stack_max = num_to_alloc;
    }
}
static void pktloc_ensure_buffer_stack ( yyscan_t yyscanner ) { yy_size_t num_to_alloc ; struct yyguts_t * yyg = ( struct yyguts_t * ) yyscanner ; if ( ! yyg -> yy_buffer_stack ) { num_to_alloc = 1 ; yyg -> yy_buffer_stack = ( struct yy_buffer_state * * ) pktloc_alloc ( num_to_alloc * sizeof ( struct yy_buffer_state * ) , yyscanner ) ; if ( ! yyg -> yy_buffer_stack ) YY_FATAL_ERROR ( " " ) ; memset ( yyg -> yy_buffer_stack , 0 , num_to_alloc * sizeof ( struct yy_buffer_state * ) ) ; yyg -> yy_buffer_stack_max = num_to_alloc ; yyg -> yy_buffer_stack_top = 0 ; return ; } if ( yyg -> yy_buffer_stack_top >= ( yyg -> yy_buffer_stack_max ) - 1 ) { yy_size_t grow_size = 8 ; num_to_alloc = yyg -> yy_buffer_stack_max + grow_size ; yyg -> yy_buffer_stack = ( struct yy_buffer_state * * ) pktloc_realloc ( yyg -> yy_buffer_stack , num_to_alloc * sizeof ( struct yy_buffer_state * ) , yyscanner ) ; if ( ! yyg -> yy_buffer_stack ) YY_FATAL_ERROR ( " " ) ; memset ( yyg -> yy_buffer_stack + yyg -> yy_buffer_stack_max , 0 , grow_size * sizeof ( struct yy_buffer_state * ) ) ; yyg -> yy_buffer_stack_max = num_to_alloc ; } }
Allocates the stack if it does not exist.
Allocates the stack if it does not exist .
/* First allocation is just for 2 elements, since we don't know if this
         * scanner will even need a stack. We use 2 instead of 1 to avoid an
         * immediate realloc on the next call.
         */ /* After all that talk, this was set to 1 anyways... */ /* Increase the buffer to prepare for a possible push. */ /* arbitrary grow size */ /* zero only the new slots.*/