diff options
author | obrien <obrien@FreeBSD.org> | 2001-07-24 14:05:21 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-07-24 14:05:21 +0000 |
commit | 6dc73139c0963b16a0a8642e6399a5433348138e (patch) | |
tree | 5cfbf3a709a30e3188c47d1beb93d8b2481dcaf0 /usr.bin/sed/main.c | |
parent | 4f82093ece0a22bfe072a2c476f29289a0773290 (diff) | |
download | FreeBSD-src-6dc73139c0963b16a0a8642e6399a5433348138e.zip FreeBSD-src-6dc73139c0963b16a0a8642e6399a5433348138e.tar.gz |
Expand xmalloc in-place, along with xrealloc; which wasn't even ANSI in its
implementation.
Diffstat (limited to 'usr.bin/sed/main.c')
-rw-r--r-- | usr.bin/sed/main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/sed/main.c b/usr.bin/sed/main.c index c189c26..2811ca6 100644 --- a/usr.bin/sed/main.c +++ b/usr.bin/sed/main.c @@ -130,7 +130,8 @@ main(argc, argv) break; case 'e': eflag = 1; - temp_arg = xmalloc(strlen(optarg) + 2); + if ((temp_arg = malloc(strlen(optarg) + 2)) == NULL) + err(1, "malloc"); strcpy(temp_arg, optarg); strcat(temp_arg, "\n"); add_compunit(CU_STRING, temp_arg); @@ -362,7 +363,8 @@ add_compunit(type, s) { struct s_compunit *cu; - cu = xmalloc(sizeof(struct s_compunit)); + if ((cu = malloc(sizeof(struct s_compunit))) == NULL) + err(1, "malloc"); cu->type = type; cu->s = s; cu->next = NULL; @@ -379,7 +381,8 @@ add_file(s) { struct s_flist *fp; - fp = xmalloc(sizeof(struct s_flist)); + if ((fp = malloc(sizeof(struct s_flist))) == NULL) + err(1, "malloc"); fp->next = NULL; *fl_nextp = fp; fp->fname = s; |