pkarashchenko commented on a change in pull request #5854: URL: https://github.com/apache/incubator-nuttx/pull/5854#discussion_r835891986
########## File path: fs/romfs/fs_romfsutil.c ########## @@ -436,51 +429,44 @@ static int romfs_cachenode(FAR struct romfs_mountpt_s *rm, return ret; } - /* Now we are pointing to the real entry of interest. Is it a - * directory? Or a file? - */ + ret = romfs_parsefilename(rm, offset, childname); + if (ret < 0) + { + return ret; + } - if (IS_DIRECTORY(next) || IS_FILE(next)) + if (strcmp(childname, ".") != 0 && strcmp(childname, "..") != 0) { - ret = romfs_parsefilename(rm, offset, childname); - if (ret < 0) + if (child == NULL || nodeinfo->rn_count == num - 1) { - return ret; - } + FAR void *tmp; - if (strcmp(childname, ".") != 0 && strcmp(childname, "..") != 0) - { - if (child == NULL || nodeinfo->rn_count == num - 1) + tmp = kmm_realloc(nodeinfo->rn_child, + (num + NODEINFO_NINCR) * + sizeof(FAR struct romfs_nodeinfo_s *)); + if (tmp == NULL) { - FAR void *tmp; - - tmp = kmm_realloc(nodeinfo->rn_child, - (num + NODEINFO_NINCR) * - sizeof(FAR struct romfs_nodeinfo_s *)); - if (tmp == NULL) - { - return -ENOMEM; - } - - nodeinfo->rn_child = tmp; - memset(nodeinfo->rn_child + num, 0, NODEINFO_NINCR * - sizeof(FAR struct romfs_nodeinfo_s *)); - num += NODEINFO_NINCR; + return -ENOMEM; } - child = &nodeinfo->rn_child[nodeinfo->rn_count++]; - if (IS_DIRECTORY(next)) - { - linkoffset = info; - } + nodeinfo->rn_child = tmp; Review comment: ok. I just checked the code and we mix if both with cast and without cast (I mean cases when return of `malloc`, `zalloc`, `realloc` and others is assigned to a non-void pointer). I'm fine to keep it as it is now. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org