Use x[mc]alloc() instead of util_[cm]alloc().
Showing
7 changed files
with
8 additions
and
8 deletions
... | @@ -99,7 +99,7 @@ alias_rehash() | ... | @@ -99,7 +99,7 @@ alias_rehash() |
99 | return 1; | 99 | return 1; |
100 | } | 100 | } |
101 | 101 | ||
102 | aliases = util_calloc(hash_size[hash_num], sizeof (aliases[0])); | 102 | aliases = xcalloc(hash_size[hash_num], sizeof (aliases[0])); |
103 | if (old_aliases) | 103 | if (old_aliases) |
104 | { | 104 | { |
105 | for (i = 0; i < hash_size[hash_num-1]; i++) | 105 | for (i = 0; i < hash_size[hash_num-1]; i++) | ... | ... |
... | @@ -72,7 +72,7 @@ mail_set_my_name (char *name) | ... | @@ -72,7 +72,7 @@ mail_set_my_name (char *name) |
72 | my_name = strdup (name); | 72 | my_name = strdup (name); |
73 | gethostname(hostname, sizeof(hostname)); | 73 | gethostname(hostname, sizeof(hostname)); |
74 | hostname[sizeof(hostname)-1] = 0; | 74 | hostname[sizeof(hostname)-1] = 0; |
75 | my_email = util_malloc (strlen (name) + strlen (hostname) + 2); | 75 | my_email = xmalloc (strlen (name) + strlen (hostname) + 2); |
76 | sprintf (my_email, "%s@%s", name, hostname); | 76 | sprintf (my_email, "%s@%s", name, hostname); |
77 | } | 77 | } |
78 | 78 | ... | ... |
... | @@ -73,7 +73,7 @@ parse_opt (int key, char *arg, struct argp_state *state) | ... | @@ -73,7 +73,7 @@ parse_opt (int key, char *arg, struct argp_state *state) |
73 | int len; | 73 | int len; |
74 | char *home = getenv("HOME"); | 74 | char *home = getenv("HOME"); |
75 | len = strlen (home) + strlen ("/mbox") + 1; | 75 | len = strlen (home) + strlen ("/mbox") + 1; |
76 | args->file = util_malloc(len * sizeof (char)); | 76 | args->file = xmalloc(len * sizeof (char)); |
77 | strcpy (args->file, home); | 77 | strcpy (args->file, home); |
78 | strcat (args->file, "/mbox"); | 78 | strcat (args->file, "/mbox"); |
79 | } | 79 | } |
... | @@ -401,7 +401,7 @@ mail_mainloop(char *(*input) __P((void *, int)), void *closure, int do_history) | ... | @@ -401,7 +401,7 @@ mail_mainloop(char *(*input) __P((void *, int)), void *closure, int do_history) |
401 | break; | 401 | break; |
402 | } | 402 | } |
403 | command[len-1] = '\0'; | 403 | command[len-1] = '\0'; |
404 | buf = util_malloc ((len + strlen (command2)) * sizeof (char)); | 404 | buf = xmalloc ((len + strlen (command2)) * sizeof (char)); |
405 | strcpy (buf, command); | 405 | strcpy (buf, command); |
406 | strcat (buf, command2); | 406 | strcat (buf, command2); |
407 | free (command); | 407 | free (command); | ... | ... |
... | @@ -470,7 +470,7 @@ readline (const char *prompt) | ... | @@ -470,7 +470,7 @@ readline (const char *prompt) |
470 | fflush (ofile); | 470 | fflush (ofile); |
471 | } | 471 | } |
472 | 472 | ||
473 | p = line = util_calloc (1, 255); | 473 | p = line = xcalloc (1, 255); |
474 | alloclen = 255; | 474 | alloclen = 255; |
475 | linelen = 0; | 475 | linelen = 0; |
476 | for (;;) | 476 | for (;;) | ... | ... |
... | @@ -48,7 +48,7 @@ mail_shell (int argc, char **argv) | ... | @@ -48,7 +48,7 @@ mail_shell (int argc, char **argv) |
48 | char *buf = NULL; | 48 | char *buf = NULL; |
49 | 49 | ||
50 | /* 1(shell) + 1 (-c) + 1(arg) + 1 (null) = 4 */ | 50 | /* 1(shell) + 1 (-c) + 1(arg) + 1 (null) = 4 */ |
51 | argvec = util_malloc (4 * (sizeof (char *))); | 51 | argvec = xmalloc (4 * (sizeof (char *))); |
52 | 52 | ||
53 | argcv_string (argc-1, &argv[1], &buf); | 53 | argcv_string (argc-1, &argv[1], &buf); |
54 | 54 | ... | ... |
... | @@ -31,7 +31,7 @@ mail_unset (int argc, char **argv) | ... | @@ -31,7 +31,7 @@ mail_unset (int argc, char **argv) |
31 | int status = 0, i = 1; | 31 | int status = 0, i = 1; |
32 | for (i=1; i < argc; i++) | 32 | for (i=1; i < argc; i++) |
33 | { | 33 | { |
34 | char *buf = util_malloc ((7+strlen (argv[i])) * sizeof (char)); | 34 | char *buf = xmalloc ((7+strlen (argv[i])) * sizeof (char)); |
35 | strcpy (buf, "set no"); | 35 | strcpy (buf, "set no"); |
36 | strcat (buf, argv[i]); | 36 | strcat (buf, argv[i]); |
37 | if (!util_do_command (buf)) | 37 | if (!util_do_command (buf)) | ... | ... |
... | @@ -430,7 +430,7 @@ var_pipe(int argc, char **argv, struct send_environ *env) | ... | @@ -430,7 +430,7 @@ var_pipe(int argc, char **argv, struct send_environ *env) |
430 | close(fd); | 430 | close(fd); |
431 | 431 | ||
432 | /* Execute the process */ | 432 | /* Execute the process */ |
433 | xargv = util_calloc(argc, sizeof(xargv[0])); | 433 | xargv = xcalloc(argc, sizeof(xargv[0])); |
434 | for (i = 0; i < argc-1; i++) | 434 | for (i = 0; i < argc-1; i++) |
435 | xargv[i] = argv[i+1]; | 435 | xargv[i] = argv[i+1]; |
436 | xargv[i] = NULL; | 436 | xargv[i] = NULL; | ... | ... |
-
Please register or sign in to post a comment