diff options
author | David Robillard <d@drobilla.net> | 2020-12-26 19:22:03 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-12-31 14:15:00 +0100 |
commit | 31cc05d5ef6e840ebe2b4c265f374f913f4758cc (patch) | |
tree | 87302811f8df1f16e0bd4785ff405906a993b7d0 /utils/uri_table.h | |
parent | 7a51f0b8e95d29b5e053db97bf72094e847ee7ef (diff) | |
download | lilv-31cc05d5ef6e840ebe2b4c265f374f913f4758cc.tar.gz lilv-31cc05d5ef6e840ebe2b4c265f374f913f4758cc.tar.bz2 lilv-31cc05d5ef6e840ebe2b4c265f374f913f4758cc.zip |
Format all code with clang-format
Diffstat (limited to 'utils/uri_table.h')
-rw-r--r-- | utils/uri_table.h | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/utils/uri_table.h b/utils/uri_table.h index 70635a3..78d3916 100644 --- a/utils/uri_table.h +++ b/utils/uri_table.h @@ -29,54 +29,52 @@ #include <string.h> typedef struct { - char** uris; - size_t n_uris; + char** uris; + size_t n_uris; } URITable; static void uri_table_init(URITable* table) { - table->uris = NULL; - table->n_uris = 0; + table->uris = NULL; + table->n_uris = 0; } static void uri_table_destroy(URITable* table) { - for (size_t i = 0; i < table->n_uris; ++i) { - free(table->uris[i]); - } + for (size_t i = 0; i < table->n_uris; ++i) { + free(table->uris[i]); + } - free(table->uris); + free(table->uris); } static LV2_URID -uri_table_map(LV2_URID_Map_Handle handle, - const char* uri) +uri_table_map(LV2_URID_Map_Handle handle, const char* uri) { - URITable* table = (URITable*)handle; - for (size_t i = 0; i < table->n_uris; ++i) { - if (!strcmp(table->uris[i], uri)) { - return i + 1; - } - } + URITable* table = (URITable*)handle; + for (size_t i = 0; i < table->n_uris; ++i) { + if (!strcmp(table->uris[i], uri)) { + return i + 1; + } + } - const size_t len = strlen(uri); - table->uris = (char**)realloc(table->uris, ++table->n_uris * sizeof(char*)); - table->uris[table->n_uris - 1] = (char*)malloc(len + 1); - memcpy(table->uris[table->n_uris - 1], uri, len + 1); - return table->n_uris; + const size_t len = strlen(uri); + table->uris = (char**)realloc(table->uris, ++table->n_uris * sizeof(char*)); + table->uris[table->n_uris - 1] = (char*)malloc(len + 1); + memcpy(table->uris[table->n_uris - 1], uri, len + 1); + return table->n_uris; } static const char* -uri_table_unmap(LV2_URID_Map_Handle handle, - LV2_URID urid) +uri_table_unmap(LV2_URID_Map_Handle handle, LV2_URID urid) { - URITable* table = (URITable*)handle; - if (urid > 0 && urid <= table->n_uris) { - return table->uris[urid - 1]; - } - return NULL; + URITable* table = (URITable*)handle; + if (urid > 0 && urid <= table->n_uris) { + return table->uris[urid - 1]; + } + return NULL; } -#endif /* URI_TABLE_H */ +#endif /* URI_TABLE_H */ |