[Bf-blender-cvs] [b5c2a75d26d] master: Cleanup: use ARRAY_SIZE when when looping over the array indicies

Campbell Barton noreply at git.blender.org
Mon Jan 4 07:41:51 CET 2021


Commit: b5c2a75d26dbd5725ee5c8f361db35aedb45efdf
Author: Campbell Barton
Date:   Mon Jan 4 14:02:01 2021 +1100
Branches: master
https://developer.blender.org/rBb5c2a75d26dbd5725ee5c8f361db35aedb45efdf

Cleanup: use ARRAY_SIZE when when looping over the array indicies

===================================================================

M	source/blender/blenkernel/intern/appdir.c

===================================================================

diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index ae0c27635a6..874b24ecfe8 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -987,7 +987,7 @@ static const int app_template_directory_id[2] = {
 bool BKE_appdir_app_template_any(void)
 {
   char temp_dir[FILE_MAX];
-  for (int i = 0; i < 2; i++) {
+  for (int i = 0; i < ARRAY_SIZE(app_template_directory_id); i++) {
     if (BKE_appdir_folder_id_ex(app_template_directory_id[i],
                                 app_template_directory_search[i],
                                 temp_dir,
@@ -1000,7 +1000,7 @@ bool BKE_appdir_app_template_any(void)
 
 bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len)
 {
-  for (int i = 0; i < 2; i++) {
+  for (int i = 0; i < ARRAY_SIZE(app_template_directory_id); i++) {
     char subdir[FILE_MAX];
     BLI_join_dirfile(subdir, sizeof(subdir), app_template_directory_search[i], app_template);
     if (BKE_appdir_folder_id_ex(app_template_directory_id[i], subdir, path, path_len)) {
@@ -1034,7 +1034,7 @@ void BKE_appdir_app_templates(ListBase *templates)
 {
   BLI_listbase_clear(templates);
 
-  for (int i = 0; i < 2; i++) {
+  for (int i = 0; i < ARRAY_SIZE(app_template_directory_id); i++) {
     char subdir[FILE_MAX];
     if (!BKE_appdir_folder_id_ex(app_template_directory_id[i],
                                  app_template_directory_search[i],



More information about the Bf-blender-cvs mailing list