diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-04-03 11:39:57 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-04-03 17:54:31 +0300 |
commit | d1011c9e641220c335aab2456b0598e2c6707d4d (patch) | |
tree | 6ad56cfcf874d46549735ee71445089592a60bba /source/blender/blenkernel/intern/idtype.c | |
parent | 3208454aa81f57d40f51ffc47e026d2a00c4f4ac (diff) |
Cleanup: clarification of 'name' in BKE_idtype functions
The 'name' parameter of `BKE_idtype_idcode_from_name()`, and the `str`
parameter of `idtype_get_info_from_name()`, are expected to be the
'user visible name' of an `IDTypeInfo` struct. This is made clearer in
the code by renaming those parameters to `idtype_name` and mentioning
it in the documentation of the `BKE_idtype_idcode_from_name()`
function.
Differential Revision: https://developer.blender.org/D7317
Diffstat (limited to 'source/blender/blenkernel/intern/idtype.c')
-rw-r--r-- | source/blender/blenkernel/intern/idtype.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c index b7fc167cf33..5a6e8f532c9 100644 --- a/source/blender/blenkernel/intern/idtype.c +++ b/source/blender/blenkernel/intern/idtype.c @@ -124,10 +124,10 @@ const IDTypeInfo *BKE_idtype_get_info_from_id(const ID *id) return BKE_idtype_get_info_from_idcode(GS(id->name)); } -static const IDTypeInfo *idtype_get_info_from_name(const char *str) +static const IDTypeInfo *idtype_get_info_from_name(const char *idtype_name) { for (int i = ARRAY_SIZE(id_types); i--;) { - if (id_types[i] != NULL && STREQ(str, id_types[i]->name)) { + if (id_types[i] != NULL && STREQ(idtype_name, id_types[i]->name)) { return id_types[i]; } } @@ -179,14 +179,14 @@ const char *BKE_idtype_idcode_to_translation_context(const short idcode) } /** - * Convert a name into an idcode (ie. ID_SCE) + * Convert an IDType name into an idcode (ie. ID_SCE) * - * \param name: The name to convert. - * \return The code for the name, or 0 if invalid. + * \param idtype_name: The IDType's 'user visible name' to convert. + * \return The idcode for the name, or 0 if invalid. */ -short BKE_idtype_idcode_from_name(const char *name) +short BKE_idtype_idcode_from_name(const char *idtype_name) { - const IDTypeInfo *id_type = idtype_get_info_from_name(name); + const IDTypeInfo *id_type = idtype_get_info_from_name(idtype_name); BLI_assert(id_type); return id_type != NULL ? id_type->id_code : 0; } |