datastore_new(): Use int as return value.

This commit is contained in:
Uwe Hermann 2010-05-09 13:32:58 +02:00
parent 33247d6acf
commit 2aebf78d9d
2 changed files with 11 additions and 13 deletions

View File

@ -25,24 +25,22 @@
static gpointer new_chunk(struct datastore **ds); static gpointer new_chunk(struct datastore **ds);
/* TODO: Return int as error status, and the struct as param. */ int datastore_new(int unitsize, struct datastore **ds)
struct datastore *datastore_new(int unitsize)
{ {
struct datastore *ds; if (!ds)
return SIGROK_ERR;
if (unitsize <= 0) if (unitsize <= 0)
// return SIGROK_ERR; return SIGROK_ERR; /* TODO: Different error? */
return NULL; /* FIXME */
if (!(ds = g_malloc(sizeof(struct datastore)))) if (!(*ds = g_malloc(sizeof(struct datastore))))
// return SIGROK_ERR_MALLOC; return SIGROK_ERR_MALLOC;
return NULL; /* FIXME */
ds->ds_unitsize = unitsize; (*ds)->ds_unitsize = unitsize;
ds->num_units = 0; (*ds)->num_units = 0;
ds->chunklist = NULL; (*ds)->chunklist = NULL;
return ds; return SIGROK_OK;
} }
int datastore_destroy(struct datastore *ds) int datastore_destroy(struct datastore *ds)

View File

@ -182,7 +182,7 @@ struct datastore {
GSList *chunklist; GSList *chunklist;
}; };
struct datastore *datastore_new(int unitsize); int datastore_new(int unitsize, struct datastore **ds);
int datastore_destroy(struct datastore *ds); int datastore_destroy(struct datastore *ds);
void datastore_put(struct datastore *ds, void *data, unsigned int length, void datastore_put(struct datastore *ds, void *data, unsigned int length,
int in_unitsize, int *probelist); int in_unitsize, int *probelist);