src/lib/gscphost/lappregistries.c
gs_retval_t streamregistry_add(FTAID ftaid,struct ringbuf * r)
{
    gs_int32_t x;
    if (lsreg == 0) {
        if ((sreg = malloc(sizeof(struct streamregistry)*STARTSZ))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory streanregistry\n");
            return -1;
        }
        memset(sreg,0,sizeof(struct streamregistry)*STARTSZ);
        lsreg = STARTSZ;
    }
    for(x=0;(x<lsreg)&&(sreg[x].used!=0);x++);
    if (x == lsreg) {
        gs_int32_t y;
        lsreg = 2*lsreg;
        if ((sreg = realloc(sreg,lsreg*sizeof(struct streamregistry)))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory streamregistry\n");
            return -1;
        }
        for (y=x;y<lsreg;y++)
            sreg[y].used=0;
    }
    sreg[x].ftaid=ftaid;
    sreg[x].r=r;
    sreg[x].used=1;
    return 0;
}
/* adds the remote streamid with its associated msgid and ringbuf
 */
adds the remote streamid with its associated msgid and ringbuf
adds the remote streamid with its associated msgid and ringbuf
gs_retval_t streamregistry_add(FTAID ftaid,struct ringbuf * r)
{
    gs_int32_t x;
    if (lsreg == 0) {
        if ((sreg = malloc(sizeof(struct streamregistry)*STARTSZ))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory streanregistry\n");
            return -1;
        }
        memset(sreg,0,sizeof(struct streamregistry)*STARTSZ);
        lsreg = STARTSZ;
    }
    for(x=0;(x<lsreg)&&(sreg[x].used!=0);x++);
    if (x == lsreg) {
        gs_int32_t y;
        lsreg = 2*lsreg;
        if ((sreg = realloc(sreg,lsreg*sizeof(struct streamregistry)))==0) {
            gslog(LOG_EMERG,"ERROR:Out of memory streamregistry\n");
            return -1;
        }
        for (y=x;y<lsreg;y++)
            sreg[y].used=0;
    }
    sreg[x].ftaid=ftaid;
    sreg[x].r=r;
    sreg[x].used=1;
    return 0;
}
gs_retval_t streamregistry_add ( FTAID ftaid , struct ringbuf * r ) { gs_int32_t x ; if ( lsreg == 0 ) { if ( ( sreg = malloc ( sizeof ( struct streamregistry ) * STARTSZ ) ) == 0 ) { gslog ( LOG_EMERG , " \n " ) ; return -1 ; } memset ( sreg , 0 , sizeof ( struct streamregistry ) * STARTSZ ) ; lsreg = STARTSZ ; } for ( x = 0 ; ( x < lsreg ) && ( sreg [ x ] . used != 0 ) ; x ++ ) ; if ( x == lsreg ) { gs_int32_t y ; lsreg = 2 * lsreg ; if ( ( sreg = realloc ( sreg , lsreg * sizeof ( struct streamregistry ) ) ) == 0 ) { gslog ( LOG_EMERG , " \n " ) ; return -1 ; } for ( y = x ; y < lsreg ; y ++ ) sreg [ y ] . used = 0 ; } sreg [ x ] . ftaid = ftaid ; sreg [ x ] . r = r ; sreg [ x ] . used = 1 ; return 0 ; }
adds the remote streamid with its associated msgid and ringbuf
adds the remote streamid with its associated msgid and ringbuf