mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
Use size_t instead of int and calloc instead of malloc
This commit is contained in:
parent
30a7488936
commit
689a6a5605
|
@ -22,7 +22,7 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char *movecmd = "move container to workspace ";
|
char *movecmd = "move container to workspace ";
|
||||||
int arglen = strlen(movecmd) + strlen(*argv) + 1;
|
size_t arglen = strlen(movecmd) + strlen(*argv) + 1;
|
||||||
char *cmdlist = calloc(1, arglen);
|
char *cmdlist = calloc(1, arglen);
|
||||||
if (!cmdlist) {
|
if (!cmdlist) {
|
||||||
return cmd_results_new(CMD_FAILURE, "assign", "Unable to allocate command list");
|
return cmd_results_new(CMD_FAILURE, "assign", "Unable to allocate command list");
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct cmd_results *cmd_for_window(int argc, char **argv) {
|
||||||
// add command to a criteria/command pair that is run against views when they appear.
|
// add command to a criteria/command pair that is run against views when they appear.
|
||||||
char *criteria = argv[0], *cmdlist = join_args(argv + 1, argc - 1);
|
char *criteria = argv[0], *cmdlist = join_args(argv + 1, argc - 1);
|
||||||
|
|
||||||
struct criteria *crit = malloc(sizeof(struct criteria));
|
struct criteria *crit = calloc(sizeof(struct criteria), 1);
|
||||||
if (!crit) {
|
if (!crit) {
|
||||||
return cmd_results_new(CMD_FAILURE, "for_window", "Unable to allocate criteria");
|
return cmd_results_new(CMD_FAILURE, "for_window", "Unable to allocate criteria");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue