code-style: remove extra casts (#130)
Co-authored-by: N-R-K <79544946+N-R-K@users.noreply.github.com>
This commit is contained in:
parent
7b08b0a31b
commit
bbebd45ce6
2
main.c
2
main.c
@ -929,7 +929,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
for (i = 0; i < ARRLEN(cmd); i++) {
|
for (i = 0; i < ARRLEN(cmd); i++) {
|
||||||
n = strlen(homedir) + strlen(dsuffix) + strlen(name[i]) + strlen(s) + 1;
|
n = strlen(homedir) + strlen(dsuffix) + strlen(name[i]) + strlen(s) + 1;
|
||||||
cmd[i]->cmd = (char*) emalloc(n);
|
cmd[i]->cmd = emalloc(n);
|
||||||
snprintf(cmd[i]->cmd, n, "%s%s%s%s", homedir, dsuffix, s, name[i]);
|
snprintf(cmd[i]->cmd, n, "%s%s%s%s", homedir, dsuffix, s, name[i]);
|
||||||
if (access(cmd[i]->cmd, X_OK) != 0)
|
if (access(cmd[i]->cmd, X_OK) != 0)
|
||||||
cmd[i]->err = errno;
|
cmd[i]->err = errno;
|
||||||
|
6
util.c
6
util.c
@ -100,7 +100,7 @@ int r_opendir(r_dir_t *rdir, const char *dirname, bool recursive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rdir->stcap = 512;
|
rdir->stcap = 512;
|
||||||
rdir->stack = (char**) emalloc(rdir->stcap * sizeof(char*));
|
rdir->stack = emalloc(rdir->stcap * sizeof(char*));
|
||||||
rdir->stlen = 0;
|
rdir->stlen = 0;
|
||||||
|
|
||||||
rdir->name = (char*) dirname;
|
rdir->name = (char*) dirname;
|
||||||
@ -153,7 +153,7 @@ char* r_readdir(r_dir_t *rdir, bool skip_dotfiles)
|
|||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(rdir->name) + strlen(dentry->d_name) + 2;
|
len = strlen(rdir->name) + strlen(dentry->d_name) + 2;
|
||||||
filename = (char*) emalloc(len);
|
filename = emalloc(len);
|
||||||
snprintf(filename, len, "%s%s%s", rdir->name,
|
snprintf(filename, len, "%s%s%s", rdir->name,
|
||||||
rdir->name[strlen(rdir->name)-1] == '/' ? "" : "/",
|
rdir->name[strlen(rdir->name)-1] == '/' ? "" : "/",
|
||||||
dentry->d_name);
|
dentry->d_name);
|
||||||
@ -164,7 +164,7 @@ char* r_readdir(r_dir_t *rdir, bool skip_dotfiles)
|
|||||||
/* put subdirectory on the stack */
|
/* put subdirectory on the stack */
|
||||||
if (rdir->stlen == rdir->stcap) {
|
if (rdir->stlen == rdir->stcap) {
|
||||||
rdir->stcap *= 2;
|
rdir->stcap *= 2;
|
||||||
rdir->stack = (char**) erealloc(rdir->stack,
|
rdir->stack = erealloc(rdir->stack,
|
||||||
rdir->stcap * sizeof(char*));
|
rdir->stcap * sizeof(char*));
|
||||||
}
|
}
|
||||||
rdir->stack[rdir->stlen++] = filename;
|
rdir->stack[rdir->stlen++] = filename;
|
||||||
|
Loading…
Reference in New Issue
Block a user