diff options
author | shdown <shdownnine@gmail.com> | 2015-08-03 12:50:50 +0300 |
---|---|---|
committer | shdown <shdownnine@gmail.com> | 2015-08-03 12:50:50 +0300 |
commit | c85d16faa4fa3fc34b35782d2281b5852e5a429b (patch) | |
tree | 3dfc41e86439813a1cb7b7b1c8fa03c925033ea9 /i3-input | |
parent | bc52fae15c75635e9cec57e25619d304dba3a69b (diff) | |
download | i3-c85d16faa4fa3fc34b35782d2281b5852e5a429b.tar.gz i3-c85d16faa4fa3fc34b35782d2281b5852e5a429b.zip |
Use safe wrappers wherever possible
Diffstat (limited to 'i3-input')
-rw-r--r-- | i3-input/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/i3-input/main.c b/i3-input/main.c index 6736aad3..cf3884e9 100644 --- a/i3-input/main.c +++ b/i3-input/main.c @@ -103,7 +103,7 @@ static void restore_input_focus(void) { * */ static uint8_t *concat_strings(char **glyphs, int max) { - uint8_t *output = calloc(max + 1, 4); + uint8_t *output = scalloc(max + 1, 4); uint8_t *walk = output; for (int c = 0; c < max; c++) { printf("at %c\n", glyphs[c][0]); @@ -187,10 +187,10 @@ static void finish_input() { /* allocate space for the output */ int inputlen = strlen(command); - char *full = calloc(1, - strlen(format) - (2 * cnt) /* format without all %s */ - + (inputlen * cnt) /* replaced %s */ - + 1); /* trailing NUL */ + char *full = scalloc(strlen(format) - (2 * cnt) /* format without all %s */ + + (inputlen * cnt) /* replaced %s */ + + 1, /* trailing NUL */ + 1); char *dest = full; for (c = 0; c < len; c++) { /* if this is not % or it is % but without a following 's', @@ -359,7 +359,7 @@ free_resources: } int main(int argc, char *argv[]) { - format = strdup("%s"); + format = sstrdup("%s"); socket_path = getenv("I3SOCK"); char *pattern = sstrdup("pango:monospace 8"); int o, option_index = 0; @@ -381,7 +381,7 @@ int main(int argc, char *argv[]) { switch (o) { case 's': FREE(socket_path); - socket_path = strdup(optarg); + socket_path = sstrdup(optarg); break; case 'v': printf("i3-input " I3_VERSION); @@ -401,11 +401,11 @@ int main(int argc, char *argv[]) { break; case 'f': FREE(pattern); - pattern = strdup(optarg); + pattern = sstrdup(optarg); break; case 'F': FREE(format); - format = strdup(optarg); + format = sstrdup(optarg); break; case 'h': printf("i3-input " I3_VERSION "\n"); |