aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-07-24 14:15:51 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-07-24 14:15:51 +0000
commita9be9be8747f50596180f264e73a6f2e2fd7bcb1 (patch)
tree231183bf6a2a2e31e819307d46beff2a2319d6d7
parent44974a7f49edcb129763abd3772555b71a47b10d (diff)
Notes
-rw-r--r--usr.bin/at/at.c17
-rw-r--r--usr.bin/at/at.h4
-rw-r--r--usr.bin/at/parsetime.c3
-rw-r--r--usr.bin/at/perm.c3
4 files changed, 10 insertions, 17 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 909207a6eada..cad2e498407b 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -156,7 +156,8 @@ static char *cwdname(void)
static size_t size = SIZE;
if (ptr == NULL)
- ptr = (char *) mymalloc(size);
+ if ((ptr = malloc(size)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
while (1)
{
@@ -171,7 +172,8 @@ static char *cwdname(void)
free (ptr);
size += SIZE;
- ptr = (char *) mymalloc(size);
+ if ((ptr = malloc(size)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
}
}
@@ -586,17 +588,6 @@ process_jobs(int argc, char **argv, int what)
}
} /* delete_jobs */
-/* Global functions */
-
-void *
-mymalloc(size_t n)
-{
- void *p;
- if ((p=malloc(n))==(void *)0)
- errx(EXIT_FAILURE, "virtual memory exhausted");
- return p;
-}
-
int
main(int argc, char **argv)
{
diff --git a/usr.bin/at/at.h b/usr.bin/at/at.h
index 40a5a6f298f9..3d72bbbdbbd4 100644
--- a/usr.bin/at/at.h
+++ b/usr.bin/at/at.h
@@ -21,11 +21,11 @@
* THEORY OF LIABILITY, WETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
extern int fcreated;
extern char *namep;
extern char atfile[];
extern char atverify;
-
-void *mymalloc(size_t n);
diff --git a/usr.bin/at/parsetime.c b/usr.bin/at/parsetime.c
index 26e559e9850e..d4e8a40b8cc8 100644
--- a/usr.bin/at/parsetime.c
+++ b/usr.bin/at/parsetime.c
@@ -185,7 +185,8 @@ init_scanner(int argc, char **argv)
while (argc-- > 0)
sc_len += strlen(*argv++);
- sc_token = (char *) mymalloc(sc_len);
+ if ((sc_token = malloc(sc_len)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
} /* init_scanner */
/*
diff --git a/usr.bin/at/perm.c b/usr.bin/at/perm.c
index e7bb9b1d555d..6380f461469b 100644
--- a/usr.bin/at/perm.c
+++ b/usr.bin/at/perm.c
@@ -64,7 +64,8 @@ static int check_for_user(FILE *fp,const char *name)
int found = 0;
len = strlen(name);
- buffer = mymalloc(len+2);
+ if ((buffer = malloc(len+2)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
while(fgets(buffer, len+2, fp) != NULL)
{