From d1011c9e641220c335aab2456b0598e2c6707d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 3 Apr 2020 10:39:57 +0200 Subject: 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 --- source/blender/blenkernel/intern/idtype.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/idtype.c') 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; } -- cgit v1.2.3