src/lib/gscphost/callbackregistries.c
gs_retval_t ftacallback_add_alloc(FTAname name, alloc_fta fta_alloc_functionptr,gs_uint64_t prefilter)
{
    gs_int32_t x;
    gslog(LOG_INFO,"Register prefilter %llu for %s\n",prefilter,name);
    if (lalloc == 0) {
        if ((falloc = malloc(sizeof(struct ftacallbackalloc)*STARTSZ))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory ftacallback\n");
            return -1;
        }
        memset(falloc,0,sizeof(struct ftacallbackalloc)*STARTSZ);
        lalloc = STARTSZ;
    }
    for(x=0;(x<lalloc)&&(falloc[x].used!=0);x++);
    if (x == lalloc) {
        gs_int32_t y;
        lalloc = 2*lalloc;
        if ((falloc = realloc(falloc,lalloc*sizeof(struct ftacallbackalloc)))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory ftacallback\n");
            return -1;
        }
        for (y=x;y<lalloc;y++)
            falloc[y].used=0;
    }
    falloc[x].name=strdup(name);
    falloc[x].fta_alloc_functionptr=fta_alloc_functionptr;
    falloc[x].prefilter=prefilter;
    falloc[x].used=1;
    return x;
}
/* registers an alloc function of an FTA and returns a unique index */
registers an alloc function of an FTA and returns a unique index
registers an alloc function of an FTA and returns a unique index
gs_retval_t ftacallback_add_alloc(FTAname name, alloc_fta fta_alloc_functionptr,gs_uint64_t prefilter)
{
    gs_int32_t x;
    gslog(LOG_INFO,"Register prefilter %llu for %s\n",prefilter,name);
    if (lalloc == 0) {
        if ((falloc = malloc(sizeof(struct ftacallbackalloc)*STARTSZ))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory ftacallback\n");
            return -1;
        }
        memset(falloc,0,sizeof(struct ftacallbackalloc)*STARTSZ);
        lalloc = STARTSZ;
    }
    for(x=0;(x<lalloc)&&(falloc[x].used!=0);x++);
    if (x == lalloc) {
        gs_int32_t y;
        lalloc = 2*lalloc;
        if ((falloc = realloc(falloc,lalloc*sizeof(struct ftacallbackalloc)))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory ftacallback\n");
            return -1;
        }
        for (y=x;y<lalloc;y++)
            falloc[y].used=0;
    }
    falloc[x].name=strdup(name);
    falloc[x].fta_alloc_functionptr=fta_alloc_functionptr;
    falloc[x].prefilter=prefilter;
    falloc[x].used=1;
    return x;
}
gs_retval_t ftacallback_add_alloc ( FTAname name , alloc_fta fta_alloc_functionptr , gs_uint64_t prefilter ) { gs_int32_t x ; gslog ( LOG_INFO , " \n " , prefilter , name ) ; if ( lalloc == 0 ) { if ( ( falloc = malloc ( sizeof ( struct ftacallbackalloc ) * STARTSZ ) ) == 0 ) { gslog ( LOG_EMERG , " \n " ) ; return -1 ; } memset ( falloc , 0 , sizeof ( struct ftacallbackalloc ) * STARTSZ ) ; lalloc = STARTSZ ; } for ( x = 0 ; ( x < lalloc ) && ( falloc [ x ] . used != 0 ) ; x ++ ) ; if ( x == lalloc ) { gs_int32_t y ; lalloc = 2 * lalloc ; if ( ( falloc = realloc ( falloc , lalloc * sizeof ( struct ftacallbackalloc ) ) ) == 0 ) { gslog ( LOG_EMERG , " \n " ) ; return -1 ; } for ( y = x ; y < lalloc ; y ++ ) falloc [ y ] . used = 0 ; } falloc [ x ] . name = strdup ( name ) ; falloc [ x ] . fta_alloc_functionptr = fta_alloc_functionptr ; falloc [ x ] . prefilter = prefilter ; falloc [ x ] . used = 1 ; return x ; }
registers an alloc function of an FTA and returns a unique index
registers an alloc function of an FTA and returns a unique index