X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=datastore.c;h=c4b82e67593e1e974e4b7d607c81b2029f042c77;hb=dddfb3dbf058a5a8f789cc4988ac3c6da836e267;hp=c7274ed30f7c246e09d6e5b046ec268867819a51;hpb=7b8ca864a00010d64172820bb82b30cb5f2d0009;p=libsigrok.git diff --git a/datastore.c b/datastore.c index c7274ed3..c4b82e67 100644 --- a/datastore.c +++ b/datastore.c @@ -21,8 +21,8 @@ #include #include #include -#include "sigrok.h" -#include "sigrok-internal.h" +#include "libsigrok.h" +#include "libsigrok-internal.h" static gpointer new_chunk(struct sr_datastore **ds); @@ -96,8 +96,7 @@ SR_API int sr_datastore_destroy(struct sr_datastore *ds) g_free(chunk->data); g_slist_free(ds->chunklist); g_free(ds); - - /* TODO: Set ds = NULL? */ + ds = NULL; return SR_OK; } @@ -129,16 +128,12 @@ SR_API int sr_datastore_destroy(struct sr_datastore *ds) * is returned, the value/state of 'ds' is undefined. */ SR_API int sr_datastore_put(struct sr_datastore *ds, void *data, - unsigned int length, int in_unitsize, int *probelist) + unsigned int length, int in_unitsize, const int *probelist) { unsigned int stored; int capacity, size, num_chunks, chunk_bytes_free, chunk_offset; gpointer chunk; - /* Avoid compiler warnings. */ - (void)in_unitsize; - (void)probelist; - if (!ds) { sr_err("ds: %s: ds was NULL", __func__); return SR_ERR_ARG; @@ -237,7 +232,8 @@ static gpointer new_chunk(struct sr_datastore **ds) chunk = g_try_malloc0(DATASTORE_CHUNKSIZE * (*ds)->ds_unitsize); if (!chunk) { - sr_err("ds: %s: chunk malloc failed", __func__); + sr_err("ds: %s: chunk malloc failed (ds_unitsize was %u)", + __func__, (*ds)->ds_unitsize); return NULL; /* TODO: SR_ERR_MALLOC later? */ }