From 194db3b3400e2f56a91e1e97ab14f6a475d4ea75 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 28 May 2023 17:50:16 -0400 Subject: opk/write: Clarify variable names --- (limited to 'src/opk') diff --git a/src/opk/write.c b/src/opk/write.c index 1b63893..fa13dbf 100644 --- a/src/opk/write.c +++ b/src/opk/write.c @@ -88,11 +88,11 @@ _opkg_opk_opk_write_dir_read(struct opkg_opk_opk *opk, { int ret; char *child_path; - int n; - struct dirent **names; - int i; + int children_n; + struct dirent **children; + int children_i; struct opkg_opk_dirent child; - size_t j; + size_t name_i; struct stat st; uid_t uid; char *uname; @@ -121,21 +121,24 @@ _opkg_opk_opk_write_dir_read(struct opkg_opk_opk *opk, *child_path = '\0'; --opk->path_len; - n = scandir(opk->path, &names, _opkg_opk_opk_write_filter, + children_n = scandir(opk->path, &children, _opkg_opk_opk_write_filter, _opkg_opk_opk_write_compar); - for (i = 0; i < n; ++i) { - child.name = names[i]->d_name; + for (children_i = 0; children_i < children_n; ++children_i) { + child.name = children[children_i]->d_name; child.parent = dir; - for (j = 0; names[i]->d_name[j] != '\0'; ++j) { - if (j == opk->path_len) { + for (name_i = 0; children[children_i]->d_name[name_i] != '\0'; + ++name_i) { + if (name_i == opk->path_len) { fprintf(stderr, "Error: File name \"%s\" too " - "long", names[i]->d_name); + "long", + children[children_i]->d_name); ret = OPKG_OPK_ERROR; goto out1; } - child_path[j] = names[i]->d_name[j]; + child_path[name_i] = + children[children_i]->d_name[name_i]; } - child_path[j] = '\0'; + child_path[name_i] = '\0'; if (lstat(opk->path, &st) != 0) { fprintf(stderr, _("Error: Failed to stat \"%s\"\n"), opk->path); @@ -277,10 +280,10 @@ _opkg_opk_opk_write_dir_read(struct opkg_opk_opk *opk, } out1: - for (i = 0; i < n; ++i) { - free(names[i]); + for (children_i = 0; children_i < children_n; ++children_i) { + free(children[children_i]); } - free(names); + free(children); out0: return ret; } -- cgit v0.9.1