summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Storer <Mark.Storer@evault.com>2014-08-15 16:50:14 -0700
committerMark Storer <Mark.Storer@evault.com>2014-08-15 16:50:14 -0700
commit4cfd3f535b95dd7e6599267ab9bf007c8e464ae0 (patch)
tree69557f0f87bb8210f7b60989ddae225f817c27ce
parentc22312f2d00ae56db499ae142656692a8750e3c9 (diff)
downloadliberasurecode-4cfd3f535b95dd7e6599267ab9bf007c8e464ae0.tar.gz
Updated liberasurecode_supported_checksum_types to accept a pointer
argument that holds the length of the list returned (i.e. the number of supported checksum types).
-rw-r--r--include/erasurecode/erasurecode.h6
-rw-r--r--src/erasurecode.c5
-rw-r--r--test/liberasurecode_test.c4
3 files changed, 9 insertions, 6 deletions
diff --git a/include/erasurecode/erasurecode.h b/include/erasurecode/erasurecode.h
index 2d1e2bb..1b26b73 100644
--- a/include/erasurecode/erasurecode.h
+++ b/include/erasurecode/erasurecode.h
@@ -115,7 +115,7 @@ struct ec_args {
* set of backends can be different from the names listed in
* ec_backend_names above.
*
- * @param num_backends - pointer to return number of backends in
+ * @param num_backends - pointer to int, size of list returned
*
* @returns list of EC backends implemented
*/
@@ -125,11 +125,11 @@ const char ** liberasurecode_supported_backends(int *num_backends);
* Returns a list of checksum types supported for fragment data, stored in
* individual fragment headers as part of fragment metadata
*
- * @param num_checksum_types - pointer to return number of checksum types in
+ * @param num_checksum_types - pointer to int, size of list returned
*
* @returns list of checksum types supported for fragment data
*/
-const char ** liberasurecode_supported_checksum_types(void);
+const char ** liberasurecode_supported_checksum_types(int *num_checksum_types);
/**
* Create a liberasurecode instance and return a descriptor
diff --git a/src/erasurecode.c b/src/erasurecode.c
index aedbae3..1e77896 100644
--- a/src/erasurecode.c
+++ b/src/erasurecode.c
@@ -246,12 +246,13 @@ const char ** liberasurecode_supported_backends(int *num_backends)
* Returns a list of checksum types supported for fragment data, stored in
* individual fragment headers as part of fragment metadata
*
- * @param num_checksum_types - pointer to return number of checksum types in
+ * @param num_checksum_types - pointer to int, size of list returned
*
* @returns list of checksum types supported for fragment data
*/
-const char ** liberasurecode_supported_checksum_types(void)
+const char ** liberasurecode_supported_checksum_types(int *num_checksum_types)
{
+ *num_checksum_types = CHKSUM_TYPES_MAX;
return (const char **) ec_chksum_types;
}
diff --git a/test/liberasurecode_test.c b/test/liberasurecode_test.c
index c0695ce..cfa24bf 100644
--- a/test/liberasurecode_test.c
+++ b/test/liberasurecode_test.c
@@ -116,9 +116,11 @@ static void test_liberasurecode_supported_backends()
static void test_liberasurecode_supported_checksum_types()
{
int i;
+ int num_checksum_types;
const char **supported_checksum_types =
- liberasurecode_supported_checksum_types();
+ liberasurecode_supported_checksum_types(&num_checksum_types);
+ assert(num_checksum_types == CHKSUM_TYPES_MAX);
for (i = 0; i < CHKSUM_TYPES_MAX; i++)
printf("%s\n", supported_checksum_types[i]);
}