Example #1
0
char *
TableFind(TTable *     const t,
          const char * const name) {

    uint16_t i=0;

    if (TableFindIndex(t,name,&i))
        return t->item[i].value;
    else
        return NULL;
}
Example #2
0
char *TableFind(TTable *t,char *name)
{
	uint16 i=0;

	/* sanity */
	if (!t || !name) {
		return 0;
	}

	if (TableFindIndex(t,name,&i)) {
		return( t->item[i].value );
	}

	return 0;
}
Example #3
0
bool
TableAddReplace(TTable *     const t,
                const char * const name,
                const char * const value) {

    uint16_t i=0;

    if (TableFindIndex(t,name,&i))
    {
        free(t->item[i].value);
        if (value)
            t->item[i].value=strdup(value);
        else
        {
            free(t->item[i].name);
            if (--t->size>0)
                t->item[i]=t->item[t->size];
        };

        return TRUE;
    }
    else
        return TableAdd(t,name,value);
}