3. Struct and Contents

An ftable list has a struct called sp_ftlist.

<<typedefs>>=
typedef struct sp_ftlist sp_ftlist;
<<structs>>=
struct sp_ftlist {
<<sp_ftlist>>
};

When an opaque struct, the size of the ftlist can be obtained with sp_ftlist_sizeof.

<<funcdefs>>=
unsigned long sp_ftlist_sizeof(void);
<<funcs>>=
unsigned long sp_ftlist_sizeof(void)
{
    return sizeof(sp_ftlist);
}

The target ftable is the exported ftable.

<<sp_ftlist>>=
sp_ftbl target;
<<init>>=
ftl->target.size = 0;
ftl->target.tbl = 0;

The list is a list of ftable pointers.

<<sp_ftlist>>=
sp_ftbl **list;
<<init>>=
ftl->list = NULL;

This can be retrieved using sp_ftlist_list.

<<funcdefs>>=
sp_ftbl** sp_ftlist_list(sp_ftlist *ftl);
<<funcs>>=
sp_ftbl** sp_ftlist_list(sp_ftlist *ftl)
{
    return ftl->list;
}

At cleanup, this list is freed.

<<clean>>=
if (ftl->list != NULL) {
    free(ftl->list);
}

The size is list size.

<<sp_ftlist>>=
int size;
<<init>>=
ftl->size = 0;

Can be retrieved via sp_ftlist_size.

<<funcdefs>>=
int sp_ftlist_size(sp_ftlist *ftl);
<<funcs>>=
int sp_ftlist_size(sp_ftlist *ftl)
{
    return ftl->size;
}



prev | home | next