diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-20 05:18:26 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-05-20 05:18:26 +0000 |
commit | db7c17d71cacfc5af407f4e30ddbc409ecd03112 (patch) | |
tree | 1cb761c6c0dc1bbf9223f465a115416edfa3aa7e /ext/SDBM_File | |
parent | 0c1a8ec7bddcb61a4b45cf947cb375e7d350aaa6 (diff) | |
download | perl-db7c17d71cacfc5af407f4e30ddbc409ecd03112.tar.gz |
various little nits
p4raw-id: //depot/perl@3436
Diffstat (limited to 'ext/SDBM_File')
-rw-r--r-- | ext/SDBM_File/sdbm/dba.c | 3 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/dbd.c | 3 | ||||
-rw-r--r-- | ext/SDBM_File/sdbm/dbe.c | 7 |
3 files changed, 12 insertions, 1 deletions
diff --git a/ext/SDBM_File/sdbm/dba.c b/ext/SDBM_File/sdbm/dba.c index 05e70c8961..9f987fd88e 100644 --- a/ext/SDBM_File/sdbm/dba.c +++ b/ext/SDBM_File/sdbm/dba.c @@ -23,6 +23,9 @@ char **argv; if (p = argv[1]) { name = (char *) malloc((n = strlen(p)) + 5); + if (!name) + oops("cannot get memory"); + strcpy(name, p); strcpy(name + n, ".pag"); diff --git a/ext/SDBM_File/sdbm/dbd.c b/ext/SDBM_File/sdbm/dbd.c index 04ab842e2d..f60f91a5f5 100644 --- a/ext/SDBM_File/sdbm/dbd.c +++ b/ext/SDBM_File/sdbm/dbd.c @@ -26,6 +26,9 @@ char **argv; if (p = argv[1]) { name = (char *) malloc((n = strlen(p)) + 5); + if (!name) + oops("cannot get memory"); + strcpy(name, p); strcpy(name + n, ".pag"); diff --git a/ext/SDBM_File/sdbm/dbe.c b/ext/SDBM_File/sdbm/dbe.c index 2a306f276e..b6bc8deba8 100644 --- a/ext/SDBM_File/sdbm/dbe.c +++ b/ext/SDBM_File/sdbm/dbe.c @@ -161,6 +161,9 @@ char *s; db.dsize = 0; db.dptr = (char *) malloc(strlen(s) * sizeof(char)); + if (!db.dptr) + oops("cannot get memory"); + for (p = db.dptr; *s != '\0'; p++, db.dsize++, s++) { if (*s == '\\') { if (*++s == 'n') @@ -198,6 +201,8 @@ datum db; char *p1, *p2; buf = (char *) malloc((db.dsize + 1) * sizeof(char)); + if (!buf) + oops("cannot get memory"); for (p1 = buf, p2 = db.dptr; *p2 != '\0'; *p1++ = *p2++); *p1 = '\0'; return buf; @@ -285,7 +290,7 @@ char **argv; } } - if (giveusage | what == YOW | argn < 1) { + if (giveusage || what == YOW || argn < 1) { fprintf(stderr, "Usage: %s databse [-m r|w|rw] [-crtx] -a|-d|-f|-F|-s [key [content]]\n", argv[0]); exit(-1); } |