[PATCH v2] taskmgr: Replace repeated assignments with for loops.