Small code clean-up.
This commit is contained in:
parent
e58e4d1061
commit
327f38d760
16
README.md
16
README.md
@ -74,7 +74,7 @@ API Reference
|
|||||||
|
|
||||||
This section describes the LibHashSet programming interface, as declared in the `<hash_set.h>` header file.
|
This section describes the LibHashSet programming interface, as declared in the `<hash_set.h>` header file.
|
||||||
|
|
||||||
LibHashSet supports sets containing values of type `uint32_t` or `uint64_t`. For each value type, separate functions are provided. The functions for `uint32_t`- and `uint64_t`-based hash sets can be distinguished by the suffix `…32` and `…64` suffix, respectively. In the following, the functions are described in their "generic" form.
|
LibHashSet supports sets containing values of type `uint32_t` or `uint64_t`. For each value type, separate functions are provided. The functions for `uint32_t`- and `uint64_t`-based hash sets can be distinguished by the suffix `…32` and `…64`, respectively. In the following, the functions are described in their "generic" (`value_t`) form.
|
||||||
|
|
||||||
***Note:*** On Microsoft Windows, when using LibHashSet as a "shared" library (DLL), the macro `HASHSET_DLL` must be defined *before* including `<hash_set.h>`! This is **not** required or allowed when using the "static" library.
|
***Note:*** On Microsoft Windows, when using LibHashSet as a "shared" library (DLL), the macro `HASHSET_DLL` must be defined *before* including `<hash_set.h>`! This is **not** required or allowed when using the "static" library.
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ Dump the current status and content of all "slots" of the hash set.
|
|||||||
```C
|
```C
|
||||||
errno_t hash_set_dump(
|
errno_t hash_set_dump(
|
||||||
const hash_set_t *const instance,
|
const hash_set_t *const instance,
|
||||||
int (*callback)(const size_t index, const int status, const uint32_t value)
|
int (*callback)(const size_t index, const char status, const value_t value)
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -416,8 +416,8 @@ errno_t hash_set_dump(
|
|||||||
```C
|
```C
|
||||||
int callback(
|
int callback(
|
||||||
const size_t index,
|
const size_t index,
|
||||||
const int status,
|
const char status,
|
||||||
const uint32_t value
|
const value_t value
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
##### Parameters
|
##### Parameters
|
||||||
@ -427,16 +427,16 @@ errno_t hash_set_dump(
|
|||||||
|
|
||||||
* `status`
|
* `status`
|
||||||
Indicates the status of the current "slot":
|
Indicates the status of the current "slot":
|
||||||
- `0` – slot is *unused*
|
- `'u'` – the slot is *unused*
|
||||||
- `1` – slot is *valid*
|
- `'v'` – the slot is *valid*
|
||||||
- `2` – slot is *deleted*
|
- `'d'` – the slot is *deleted*
|
||||||
|
|
||||||
* `value`
|
* `value`
|
||||||
The value that is stored at the current "slot" index.
|
The value that is stored at the current "slot" index.
|
||||||
|
|
||||||
##### Return value
|
##### Return value
|
||||||
|
|
||||||
If the function returns *zero*, the iteration is cancelled; otherwise the iteration continues.
|
If the function returns a *non-zero* value, the iteration continues; otherwise it is cancelled.
|
||||||
|
|
||||||
#### Return value
|
#### Return value
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ HASHSET_API size_t hash_set_size64(const hash_set64_t *const instance);
|
|||||||
HASHSET_API errno_t hash_set_info32(const hash_set32_t *const instance, size_t *const capacity, size_t *const valid, size_t *const deleted, size_t *const limit);
|
HASHSET_API errno_t hash_set_info32(const hash_set32_t *const instance, size_t *const capacity, size_t *const valid, size_t *const deleted, size_t *const limit);
|
||||||
HASHSET_API errno_t hash_set_info64(const hash_set64_t *const instance, size_t *const capacity, size_t *const valid, size_t *const deleted, size_t *const limit);
|
HASHSET_API errno_t hash_set_info64(const hash_set64_t *const instance, size_t *const capacity, size_t *const valid, size_t *const deleted, size_t *const limit);
|
||||||
|
|
||||||
HASHSET_API errno_t hash_set_dump32(const hash_set32_t *const instance, int (*const callback)(const size_t index, const int status, const uint32_t value));
|
HASHSET_API errno_t hash_set_dump32(const hash_set32_t *const instance, int (*const callback)(const size_t index, const char status, const uint32_t value));
|
||||||
HASHSET_API errno_t hash_set_dump64(const hash_set64_t *const instance, int (*const callback)(const size_t index, const int status, const uint64_t value));
|
HASHSET_API errno_t hash_set_dump64(const hash_set64_t *const instance, int (*const callback)(const size_t index, const char status, const uint64_t value));
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ errno_t MAKE_NAME(hash_set_info)(const hash_set_t *const instance, size_t *const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HASHSET_API errno_t MAKE_NAME(hash_set_dump)(const hash_set_t *const instance, int (*const callback)(const size_t index, const int status, const value_t value))
|
HASHSET_API errno_t MAKE_NAME(hash_set_dump)(const hash_set_t *const instance, int (*const callback)(const size_t index, const char status, const value_t value))
|
||||||
{
|
{
|
||||||
size_t index;
|
size_t index;
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ HASHSET_API errno_t MAKE_NAME(hash_set_dump)(const hash_set_t *const instance, i
|
|||||||
|
|
||||||
for (index = 0U; index < instance->data.capacity; ++index)
|
for (index = 0U; index < instance->data.capacity; ++index)
|
||||||
{
|
{
|
||||||
if (!callback(index, get_flag(instance->data.used, index) ? (get_flag(instance->data.deleted, index) ? 2 : 1) : 0, instance->data.values[index]))
|
if (!callback(index, get_flag(instance->data.used, index) ? (get_flag(instance->data.deleted, index) ? 'd' : 'v') : 'u', instance->data.values[index]))
|
||||||
{
|
{
|
||||||
return ECANCELED;
|
return ECANCELED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user