aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-03-21 22:32:57 +0000
committerErik Andersen <andersen@codepoet.org>2000-03-21 22:32:57 +0000
commit0d068a20676144e9fd6796cc77764c420d785394 (patch)
treeaf12b114d51e9ae7a8753baf09feb9ab8d654f26 /coreutils
parentc053e41fa0524d828bf90f47e5e3637b8facaadc (diff)
downloadbusybox-w32-0d068a20676144e9fd6796cc77764c420d785394.tar.gz
busybox-w32-0d068a20676144e9fd6796cc77764c420d785394.tar.bz2
busybox-w32-0d068a20676144e9fd6796cc77764c420d785394.zip
* all mallocs now use xmalloc (and so are OOM error safe), and
the common error handling saves a few bytes. Thanks to Bob Tinsley <bob@earthrise.demon.co.uk> for the patch. -Erik
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/date.c2
-rw-r--r--coreutils/dd.c6
-rw-r--r--coreutils/tr.c5
3 files changed, 4 insertions, 9 deletions
diff --git a/coreutils/date.c b/coreutils/date.c
index b4c3e7153..652db8d74 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -276,7 +276,7 @@ int date_main(int argc, char **argv)
276 } 276 }
277 277
278 /* Print OUTPUT (after ALL that!) */ 278 /* Print OUTPUT (after ALL that!) */
279 t_buff = malloc(201); 279 t_buff = xmalloc(201);
280 strftime(t_buff, 200, date_fmt, &tm_time); 280 strftime(t_buff, 200, date_fmt, &tm_time);
281 printf("%s\n", t_buff); 281 printf("%s\n", t_buff);
282 282
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 0d5b3e8ab..f40dec712 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -114,11 +114,7 @@ extern int dd_main(int argc, char **argv)
114 argv++; 114 argv++;
115 } 115 }
116 116
117 buf = malloc(blockSize); 117 buf = xmalloc(blockSize);
118 if (buf == NULL) {
119 fprintf(stderr, "Cannot allocate buffer\n");
120 exit(FALSE);
121 }
122 118
123 intotal = 0; 119 intotal = 0;
124 outTotal = 0; 120 outTotal = 0;
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 8ac09e641..3bfa48080 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)tr.c 8.2 (Berkeley) 5/4/95";
44#endif 44#endif
45static const char rcsid[] = 45static const char rcsid[] =
46 46
47 "$Id: tr.c,v 1.1 2000/03/05 08:07:00 erik Exp $"; 47 "$Id: tr.c,v 1.2 2000/03/21 22:32:57 erik Exp $";
48#endif /* not lint */ 48#endif /* not lint */
49#endif /* #if 0 */ 49#endif /* #if 0 */
50 50
@@ -433,8 +433,7 @@ STR *s;
433 "unknown class %s", 433 "unknown class %s",
434 s->str); 434 s->str);
435 435
436 if ((cp->set = p = malloc((NCHARS + 1) * sizeof(int))) == NULL) 436 cp->set = p = xmalloc((NCHARS + 1) * sizeof(int));
437 errx(1, "malloc");
438 bzero(p, (NCHARS + 1) * sizeof(int)); 437 bzero(p, (NCHARS + 1) * sizeof(int));
439 438
440 for (cnt = 0, func = cp->func; cnt < NCHARS; ++cnt) 439 for (cnt = 0, func = cp->func; cnt < NCHARS; ++cnt)