X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=datastore.c;h=16346695a855b9f0f6be18938387ef9346c7dbcc;hb=c073af80f89d8bce8675068d084c96e0cf37bb4f;hp=36bde28105e24d1ec5d4b3cd570ac23934b6c329;hpb=8ec95d22822ed5ebf4b6aeaff654608ad0225073;p=libsigrok.git diff --git a/datastore.c b/datastore.c index 36bde281..16346695 100644 --- a/datastore.c +++ b/datastore.c @@ -21,8 +21,22 @@ #include #include #include -#include "sigrok.h" -#include "sigrok-internal.h" +#include "libsigrok.h" +#include "libsigrok-internal.h" + +/** + * @file + * + * Creating, using, or destroying libsigrok datastores. + */ + +/** + * @defgroup grp_datastore Datastore + * + * Creating, using, or destroying libsigrok datastores. + * + * @{ + */ static gpointer new_chunk(struct sr_datastore **ds); @@ -36,8 +50,8 @@ static gpointer new_chunk(struct sr_datastore **ds); * It is the caller's responsibility to free the allocated memory of the * datastore via the sr_datastore_destroy() function, if no longer needed. * - * TODO: Unitsize should probably be unsigned int or uint32_t or similar. - * TODO: This function should have a 'chunksize' parameter, and + * @todo Unitsize should probably be unsigned int or uint32_t or similar. + * @todo This function should have a 'chunksize' parameter, and * struct sr_datastore a 'chunksize' field. * * @param unitsize The unit size (>= 1) to be used for this datastore. @@ -104,20 +118,20 @@ SR_API int sr_datastore_destroy(struct sr_datastore *ds) /** * Append some data to the specified datastore. * - * TODO: More elaborate function description. - * - * TODO: This function should use the (not yet available) 'chunksize' field + * @todo More elaborate function description. + * @todo This function should use the (not yet available) 'chunksize' field * of struct sr_datastore (instead of hardcoding DATASTORE_CHUNKSIZE). - * TODO: in_unitsize and probelist are unused? - * TODO: A few of the parameters can be const. - * TODO: Ideally, 'ds' should be unmodified upon errors. + * @todo in_unitsize and probelist are unused? + * @todo A few of the parameters can be const. + * @todo Ideally, 'ds' should be unmodified upon errors. + * @todo Should 0 be allowed as length? + * @todo Specify/document the data format of the 'data' parameter. * * @param ds Pointer to the datastore which shall receive the data. * Must not be NULL. * @param data Pointer to the memory buffer containing the data to add. - * Must not be NULL. TODO: Data format? + * Must not be NULL. * @param length Length of the data to add (in number of bytes). - * TODO: Should 0 be allowed as length? * @param in_unitsize The unit size (>= 1) of the input data. * @param probelist Pointer to a list of integers (probe numbers). The probe * numbers in this list are 1-based, i.e. the first probe @@ -215,9 +229,9 @@ SR_API int sr_datastore_put(struct sr_datastore *ds, void *data, * * The allocated memory is guaranteed to be cleared. * - * TODO: This function should use the datastore's 'chunksize' field instead + * @todo This function should use the datastore's 'chunksize' field instead * of hardcoding DATASTORE_CHUNKSIZE. - * TODO: Return int, so we can return SR_OK / SR_ERR_ARG / SR_ERR_MALLOC? + * @todo Return int, so we can return SR_OK / SR_ERR_ARG / SR_ERR_MALLOC? * * @param ds Pointer to a variable which holds the datastore structure. * Must not be NULL. The contents of 'ds' are modified in-place. @@ -232,7 +246,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? */ } @@ -240,3 +255,5 @@ static gpointer new_chunk(struct sr_datastore **ds) return chunk; /* TODO: SR_OK later? */ } + +/** @} */