[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nmh-commits] nmh ./ChangeLog h/utils.h sbr/brkstring.c sbr/f...
From: |
Josh Bressers |
Subject: |
[Nmh-commits] nmh ./ChangeLog h/utils.h sbr/brkstring.c sbr/f... |
Date: |
Mon, 02 Jan 2006 03:25:19 +0000 |
CVSROOT: /sources/nmh
Module name: nmh
Branch:
Changes by: Josh Bressers <address@hidden> 06/01/02 03:25:18
Modified files:
. : ChangeLog
h : utils.h
sbr : brkstring.c fmt_addr.c folder_read.c
folder_realloc.c mf.c seq_list.c utils.c
vfgets.c
uip : anno.c annosbr.c conflict.c dropsbr.c flist.c
folder.c mark.c mhlist.c mhlsbr.c mhn.c
mhpath.c mhshow.c mhstore.c mhtest.c msh.c
packf.c pick.c popsbr.c refile.c replsbr.c
rmm.c scan.c sendsbr.c sortm.c
Log message:
* patch #3967: Create a mh_xrealloc function to prevent mistakes when
calling realloc.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/ChangeLog.diff?tr1=1.218&tr2=1.219&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/h/utils.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/brkstring.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/fmt_addr.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/folder_read.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/folder_realloc.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/mf.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/seq_list.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/utils.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/sbr/vfgets.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/anno.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/annosbr.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/conflict.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/dropsbr.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/flist.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/folder.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mark.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhlist.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhlsbr.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhn.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhpath.c.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhshow.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhstore.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/mhtest.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/msh.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/packf.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/pick.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/popsbr.c.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/refile.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/replsbr.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/rmm.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/scan.c.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/sendsbr.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/nmh/nmh/uip/sortm.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
Patches:
Index: nmh/ChangeLog
diff -u nmh/ChangeLog:1.218 nmh/ChangeLog:1.219
--- nmh/ChangeLog:1.218 Mon Jan 2 03:17:41 2006
+++ nmh/ChangeLog Mon Jan 2 03:25:18 2006
@@ -1,5 +1,10 @@
2006-01-01 Josh Bressers <address@hidden>
+ * patch #3967: Create a mh_xrealloc function to prevent mistakes when
+ calling realloc.
+
+2006-01-01 Josh Bressers <address@hidden>
+
* patch #3966: Create a mh_xmalloc function to prevent mistakes when
calling malloc.
Index: nmh/h/utils.h
diff -u nmh/h/utils.h:1.1 nmh/h/utils.h:1.2
--- nmh/h/utils.h:1.1 Mon Jan 2 03:17:41 2006
+++ nmh/h/utils.h Mon Jan 2 03:25:18 2006
@@ -2,8 +2,8 @@
/*
* utils.h -- utility prototypes
*
- * $Id: utils.h,v 1.1 2006/01/02 03:17:41 bress Exp $
+ * $Id: utils.h,v 1.2 2006/01/02 03:25:18 bress Exp $
*/
void *mh_xmalloc(size_t);
-
+void *mh_xrealloc(void *, size_t);
Index: nmh/sbr/brkstring.c
diff -u nmh/sbr/brkstring.c:1.3 nmh/sbr/brkstring.c:1.4
--- nmh/sbr/brkstring.c:1.3 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/brkstring.c Mon Jan 2 03:25:18 2006
@@ -3,7 +3,7 @@
* brkstring.c -- (destructively) split a string into
* -- an array of substrings
*
- * $Id: brkstring.c,v 1.3 2006/01/02 03:17:42 bress Exp $
+ * $Id: brkstring.c,v 1.4 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -48,8 +48,7 @@
/* enlarge pointer array, if necessary */
if (i >= len) {
len += NUMBROKEN;
- if (!(broken = realloc (broken, (size_t) (len * sizeof(*broken)))))
- adios (NULL, "unable to realloc array in brkstring");
+ broken = mh_xrealloc (broken, (size_t) (len * sizeof(*broken)));
}
while (brkany (c = *s, brksep))
Index: nmh/sbr/fmt_addr.c
diff -u nmh/sbr/fmt_addr.c:1.4 nmh/sbr/fmt_addr.c:1.5
--- nmh/sbr/fmt_addr.c:1.4 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/fmt_addr.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* fmt_addr.c -- format an address field (from fmt_scan)
*
- * $Id: fmt_addr.c,v 1.4 2006/01/02 03:17:42 bress Exp $
+ * $Id: fmt_addr.c,v 1.5 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -29,11 +29,9 @@
int i = dst - buf;\
int n = last_dst - buf;\
bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\
- buf = realloc (buf, bufsiz);\
+ buf = mh_xrealloc (buf, bufsiz);\
dst = buf + i;\
last_dst = buf + n;\
- if (! buf)\
- adios (NULL, "formataddr: couldn't get buffer space");\
bufend = buf + bufsiz;\
}
Index: nmh/sbr/folder_read.c
diff -u nmh/sbr/folder_read.c:1.5 nmh/sbr/folder_read.c:1.6
--- nmh/sbr/folder_read.c:1.5 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/folder_read.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* folder_read.c -- initialize folder structure and read folder
*
- * $Id: folder_read.c,v 1.5 2006/01/02 03:17:42 bress Exp $
+ * $Id: folder_read.c,v 1.6 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -76,10 +76,7 @@
*/
if (mp->nummsg >= len) {
len += NUMMSGS;
- if (!(mi = (int *) realloc (mi,
- (size_t) (len * sizeof(*mi))))) {
- adios (NULL, "unable to allocate storage");
- }
+ mi = (int *) mh_xrealloc (mi, (size_t) (len * sizeof(*mi)));
}
/* Check if this is the first message we've seen */
Index: nmh/sbr/folder_realloc.c
diff -u nmh/sbr/folder_realloc.c:1.3 nmh/sbr/folder_realloc.c:1.4
--- nmh/sbr/folder_realloc.c:1.3 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/folder_realloc.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* folder_realloc.c -- realloc a folder/msgs structure
*
- * $Id: folder_realloc.c,v 1.3 2006/01/02 03:17:42 bress Exp $
+ * $Id: folder_realloc.c,v 1.4 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -47,10 +47,7 @@
* status array. So we don't have to move anything and can
* just realloc the message status array.
*/
- if (!(mp->msgstats = realloc (mp->msgstats, MSGSTATSIZE(mp, lo, hi)))) {
- advise (NULL, "unable to reallocate message storage");
- return NULL;
- }
+ mp->msgstats = mh_xrealloc (mp->msgstats, MSGSTATSIZE(mp, lo, hi));
} else {
/*
* We are changing the offset of the message status
Index: nmh/sbr/mf.c
diff -u nmh/sbr/mf.c:1.4 nmh/sbr/mf.c:1.5
--- nmh/sbr/mf.c:1.4 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/mf.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mf.c -- mail filter subroutines
*
- * $Id: mf.c,v 1.4 2006/01/02 03:17:42 bress Exp $
+ * $Id: mf.c,v 1.5 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -975,13 +975,8 @@
break;
}
if (cp >= ep) {
- if (!(dp = realloc (pp, (size_t) (len += BUFSIZ)))) {
- free (pp);
- pp = NULL;
- return NOTOK;
- }
- else
- cp += dp - pp, ep = (pp = cp) + len - 2;
+ dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+ cp += dp - pp, ep = (pp = cp) + len - 2;
}
}
}
Index: nmh/sbr/seq_list.c
diff -u nmh/sbr/seq_list.c:1.3 nmh/sbr/seq_list.c:1.4
--- nmh/sbr/seq_list.c:1.3 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/seq_list.c Mon Jan 2 03:25:18 2006
@@ -3,7 +3,7 @@
* seq_list.c -- Get all messages in a sequence and return them
* -- as a space separated list of message ranges.
*
- * $Id: seq_list.c,v 1.3 2006/01/02 03:17:42 bress Exp $
+ * $Id: seq_list.c,v 1.4 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -75,8 +75,7 @@
char *newbuf;
len += MAXBUFFER;
- if (!(newbuf = realloc (buffer, (size_t) len)))
- adios (NULL, "unable to realloc storage in seq_list");
+ newbuf = mh_xrealloc (buffer, (size_t) len);
bp = newbuf + (bp - buffer);
buffer = newbuf;
}
Index: nmh/sbr/utils.c
diff -u nmh/sbr/utils.c:1.1 nmh/sbr/utils.c:1.2
--- nmh/sbr/utils.c:1.1 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/utils.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* utils.c -- various utility routines
*
- * $Id: utils.c,v 1.1 2006/01/02 03:17:42 bress Exp $
+ * $Id: utils.c,v 1.2 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2006, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -27,3 +27,18 @@
return memory;
}
+
+void *
+mh_xrealloc(void *ptr, size_t size)
+{
+ void *memory;
+
+ if (size == 0)
+ adios(NULL, "Tried to realloc 0bytes");
+
+ memory = realloc(ptr, size);
+ if (!memory)
+ adios(NULL, "Realloc failed");
+
+ return memory;
+}
Index: nmh/sbr/vfgets.c
diff -u nmh/sbr/vfgets.c:1.3 nmh/sbr/vfgets.c:1.4
--- nmh/sbr/vfgets.c:1.3 Mon Jan 2 03:17:42 2006
+++ nmh/sbr/vfgets.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* vfgets.c -- virtual fgets
*
- * $Id: vfgets.c,v 1.3 2006/01/02 03:17:42 bress Exp $
+ * $Id: vfgets.c,v 1.4 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -66,12 +66,9 @@
if (cp >= ep) {
int curlen = cp - pp;
- if (!(dp = realloc (pp, (size_t) (len += BUFSIZ)))) {
- adios (NULL, "unable to allocate string storage");
- } else {
- cp = dp + curlen;
- ep = (pp = dp) + len - 1;
- }
+ dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+ cp = dp + curlen;
+ ep = (pp = dp) + len - 1;
}
}
}
Index: nmh/uip/anno.c
diff -u nmh/uip/anno.c:1.7 nmh/uip/anno.c:1.8
--- nmh/uip/anno.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/anno.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* anno.c -- annotate messages
*
- * $Id: anno.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: anno.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -233,9 +233,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/annosbr.c
diff -u nmh/uip/annosbr.c:1.7 nmh/uip/annosbr.c:1.8
--- nmh/uip/annosbr.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/annosbr.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* annosbr.c -- prepend annotation to messages
*
- * $Id: annosbr.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: annosbr.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -120,8 +120,7 @@
}
if (++n >= field_size - 1) {
- if ((field = (char *)realloc((void *)field, field_size += 256))
== (char *)0)
- adios(NULL, "can't grow field buffer.");
+ field = (char *) mh_xrealloc((void *)field, field_size += 256);
cp = field + n - 1;
}
@@ -262,8 +261,7 @@
}
if (++n >= field_size - 1) {
- if ((field = (char *)realloc((void *)field, field_size *=
2)) == (char *)0)
- adios(NULL, "can't grow field buffer.");
+ field = (char *) mh_xrealloc((void *)field, field_size *=
2);
cp = field + n - 1;
}
Index: nmh/uip/conflict.c
diff -u nmh/uip/conflict.c:1.7 nmh/uip/conflict.c:1.8
--- nmh/uip/conflict.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/conflict.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* conflict.c -- check for conflicts in mail system
*
- * $Id: conflict.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: conflict.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -205,9 +205,8 @@
if (i >= numgroups) {
if (numgroups >= maxgroups) {
maxgroups += NGRPS;
- if (!(grps = (char **) realloc(grps,
- (size_t) (maxgroups * sizeof(*grps)))))
- adios (NULL, "unable to reallocate group name storage");
+ grps = (char **) mh_xrealloc(grps,
+ (size_t) (maxgroups * sizeof(*grps)));
}
grps[numgroups++] = getcpy (gr->gr_name);
}
Index: nmh/uip/dropsbr.c
diff -u nmh/uip/dropsbr.c:1.8 nmh/uip/dropsbr.c:1.9
--- nmh/uip/dropsbr.c:1.8 Tue Sep 30 16:57:48 2003
+++ nmh/uip/dropsbr.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* dropsbr.c -- create/read/manipulate mail drops
*
- * $Id: dropsbr.c,v 1.8 2003/09/30 16:57:48 gbburkhardt Exp $
+ * $Id: dropsbr.c,v 1.9 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -10,6 +10,7 @@
*/
#include <h/nmh.h>
+#include <h/utils.h>
#ifndef MMDFONLY
# include <h/mh.h>
@@ -224,14 +225,8 @@
if (dp >= ep) {
register int curlen = dp - pp;
- cp = (struct drop *) realloc ((char *) pp,
+ cp = (struct drop *) mh_xrealloc ((char *) pp,
(size_t) (len += MAXFOLDER) * sizeof(*pp));
- if (cp == NULL) {
- if (noisy)
- admonish (NULL, "unable to allocate drop storage");
- free ((char *) pp);
- return 0;
- }
dp = cp + curlen, ep = (pp = cp) + len - 1;
}
}
Index: nmh/uip/flist.c
diff -u nmh/uip/flist.c:1.7 nmh/uip/flist.c:1.8
--- nmh/uip/flist.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/flist.c Mon Jan 2 03:25:18 2006
@@ -13,7 +13,7 @@
* makes no warranty about the software, its performance or its conformity to
* any specification.
*
- * $Id: flist.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: flist.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*/
#include <h/mh.h>
@@ -228,9 +228,8 @@
*/
if (numfolders >= maxfolders) {
maxfolders += MAXFOLDERS;
- if (!(foldersToDo = (char **) realloc (foldersToDo,
- (size_t) (maxfolders * sizeof(*foldersToDo)))))
- adios (NULL, "unable to reallocate folder name storage");
+ foldersToDo = (char **) mh_xrealloc (foldersToDo,
+ (size_t) (maxfolders * sizeof(*foldersToDo)));
}
if (*cp == '+' || *cp == '@') {
foldersToDo[numfolders++] =
@@ -655,7 +654,7 @@
*f = (struct Folder *) mh_xmalloc (*nfa * (sizeof(struct Folder)));
} else {
*nfa *= 2;
- *f = (struct Folder *) realloc (*f, *nfa * (sizeof(struct Folder)));
+ *f = (struct Folder *) mh_xrealloc (*f, *nfa * (sizeof(struct Folder)));
}
}
Index: nmh/uip/folder.c
diff -u nmh/uip/folder.c:1.7 nmh/uip/folder.c:1.8
--- nmh/uip/folder.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/folder.c Mon Jan 2 03:25:18 2006
@@ -4,7 +4,7 @@
* -- push/pop a folder onto/from the folder stack
* -- list the folder stack
*
- * $Id: folder.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: folder.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -469,8 +469,7 @@
*/
if (total_folders >= maxFolderInfo) {
maxFolderInfo += NUMFOLDERS;
- if ((fi = realloc (fi, maxFolderInfo * sizeof(*fi))) == NULL)
- adios (NULL, "unable to re-allocate storage for folder info");
+ fi = mh_xrealloc (fi, maxFolderInfo * sizeof(*fi));
}
fi[i].name = fold;
@@ -774,8 +773,7 @@
/* if necessary, reallocate the space for folder names */
if (foldp >= maxfolders) {
maxfolders += NUMFOLDERS;
- if ((folds = realloc (folds, maxfolders * sizeof(char *))) == NULL)
- adios (NULL, "unable to re-allocate storage for folder names");
+ folds = mh_xrealloc (folds, maxfolders * sizeof(char *));
}
cp = getcpy (fold);
Index: nmh/uip/mark.c
diff -u nmh/uip/mark.c:1.5 nmh/uip/mark.c:1.6
--- nmh/uip/mark.c:1.5 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mark.c Mon Jan 2 03:25:18 2006
@@ -4,7 +4,7 @@
* -- delete messages (s) from sequences in given folder
* -- list sequences in given folder
*
- * $Id: mark.c,v 1.5 2006/01/02 03:17:42 bress Exp $
+ * $Id: mark.c,v 1.6 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -159,9 +159,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs *
sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/mhlist.c
diff -u nmh/uip/mhlist.c:1.9 nmh/uip/mhlist.c:1.10
--- nmh/uip/mhlist.c:1.9 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhlist.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhlist.c -- list the contents of MIME messages
*
- * $Id: mhlist.c,v 1.9 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhlist.c,v 1.10 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -264,9 +264,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/mhlsbr.c
diff -u nmh/uip/mhlsbr.c:1.8 nmh/uip/mhlsbr.c:1.9
--- nmh/uip/mhlsbr.c:1.8 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhlsbr.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhlsbr.c -- main routines for nmh message lister
*
- * $Id: mhlsbr.c,v 1.8 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhlsbr.c,v 1.9 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -1644,8 +1644,7 @@
if (cp) {
int j;
char *dp;
- if ((dp = realloc (cp, (unsigned) (j = len + i))) == NULL)
- adios (NULL, "unable to allocate face storage");
+ dp = mh_xrealloc (cp, (unsigned) (j = len + i));
memcpy(dp + len, buffer, i);
cp = dp, len = j;
}
Index: nmh/uip/mhn.c
diff -u nmh/uip/mhn.c:1.9 nmh/uip/mhn.c:1.10
--- nmh/uip/mhn.c:1.9 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhn.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhn.c -- display, list, cache, or store the contents of MIME messages
*
- * $Id: mhn.c,v 1.9 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhn.c,v 1.10 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -20,6 +20,7 @@
#include <h/mime.h>
#include <h/mhparse.h>
#include <h/mhcachesbr.h>
+#include <h/utils.h>
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
@@ -448,9 +449,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/mhpath.c
diff -u nmh/uip/mhpath.c:1.5 nmh/uip/mhpath.c:1.6
--- nmh/uip/mhpath.c:1.5 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhpath.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhpath.c -- print full pathnames of nmh messages and folders
*
- * $Id: mhpath.c,v 1.5 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhpath.c,v 1.6 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -89,9 +89,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage ");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/mhshow.c
diff -u nmh/uip/mhshow.c:1.9 nmh/uip/mhshow.c:1.10
--- nmh/uip/mhshow.c:1.9 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhshow.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhshow.c -- display the contents of MIME messages
*
- * $Id: mhshow.c,v 1.9 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhshow.c,v 1.10 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -305,9 +305,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/mhstore.c
diff -u nmh/uip/mhstore.c:1.9 nmh/uip/mhstore.c:1.10
--- nmh/uip/mhstore.c:1.9 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhstore.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhstore.c -- store the contents of MIME messages
*
- * $Id: mhstore.c,v 1.9 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhstore.c,v 1.10 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -251,9 +251,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/mhtest.c
diff -u nmh/uip/mhtest.c:1.9 nmh/uip/mhtest.c:1.10
--- nmh/uip/mhtest.c:1.9 Mon Jan 2 03:17:42 2006
+++ nmh/uip/mhtest.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* mhtest.c -- test harness for MIME routines
*
- * $Id: mhtest.c,v 1.9 2006/01/02 03:17:42 bress Exp $
+ * $Id: mhtest.c,v 1.10 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -252,9 +252,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/msh.c
diff -u nmh/uip/msh.c:1.8 nmh/uip/msh.c:1.9
--- nmh/uip/msh.c:1.8 Tue Jul 2 22:09:14 2002
+++ nmh/uip/msh.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* msh.c -- The nmh shell
*
- * $Id: msh.c,v 1.8 2002/07/02 22:09:14 kenh Exp $
+ * $Id: msh.c,v 1.9 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -22,6 +22,7 @@
#include <h/scansbr.h>
#include <h/tws.h>
#include <h/mts.h>
+#include <h/utils.h>
#ifdef HAVE_TERMIOS_H
# include <termios.h>
@@ -941,9 +942,7 @@
return;
nmsgs = nMsgs + n + MAXFOLDER / 2;
- Msgs = (struct Msg *) realloc ((char *) Msgs, (size_t) (nmsgs + 2) *
sizeof *Msgs);
- if (Msgs == NULL)
- padios (NULL, "unable to reallocate Msgs structure");
+ Msgs = (struct Msg *) mh_xrealloc ((char *) Msgs, (size_t) (nmsgs + 2) *
sizeof *Msgs);
memset((char *) (Msgs + nMsgs + 2), 0, (size_t) ((nmsgs - nMsgs) * sizeof
*Msgs));
nMsgs = nmsgs;
Index: nmh/uip/packf.c
diff -u nmh/uip/packf.c:1.6 nmh/uip/packf.c:1.7
--- nmh/uip/packf.c:1.6 Mon Jan 2 03:17:42 2006
+++ nmh/uip/packf.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* packf.c -- pack a nmh folder into a file
*
- * $Id: packf.c,v 1.6 2006/01/02 03:17:42 bress Exp $
+ * $Id: packf.c,v 1.7 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -119,9 +119,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/pick.c
diff -u nmh/uip/pick.c:1.7 nmh/uip/pick.c:1.8
--- nmh/uip/pick.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/pick.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* pick.c -- search for messages by content
*
- * $Id: pick.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: pick.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -199,9 +199,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs *
sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/popsbr.c
diff -u nmh/uip/popsbr.c:1.14 nmh/uip/popsbr.c:1.15
--- nmh/uip/popsbr.c:1.14 Mon Jan 2 03:17:42 2006
+++ nmh/uip/popsbr.c Mon Jan 2 03:25:18 2006
@@ -1,7 +1,7 @@
/*
* popsbr.c -- POP client subroutines
*
- * $Id: popsbr.c,v 1.14 2006/01/02 03:17:42 bress Exp $
+ * $Id: popsbr.c,v 1.15 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -1238,12 +1238,7 @@
}
if (retbufsize > size) {
- buffer = realloc(buffer, retbufsize);
- if (!buffer) {
- snprintf(response, sizeof(response), "Error during realloc in "
- "read routine: %s", strerror(errno));
- return -2;
- }
+ buffer = mh_xrealloc(buffer, retbufsize);
size = retbufsize;
}
Index: nmh/uip/refile.c
diff -u nmh/uip/refile.c:1.8 nmh/uip/refile.c:1.9
--- nmh/uip/refile.c:1.8 Mon Jan 2 03:17:42 2006
+++ nmh/uip/refile.c Mon Jan 2 03:25:18 2006
@@ -3,7 +3,7 @@
* refile.c -- move or link message(s) from a source folder
* -- into one or more destination folders
*
- * $Id: refile.c,v 1.8 2006/01/02 03:17:42 bress Exp $
+ * $Id: refile.c,v 1.9 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -185,9 +185,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs *
sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/replsbr.c
diff -u nmh/uip/replsbr.c:1.7 nmh/uip/replsbr.c:1.8
--- nmh/uip/replsbr.c:1.7 Mon Jan 2 03:17:42 2006
+++ nmh/uip/replsbr.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* replsbr.c -- routines to help repl along...
*
- * $Id: replsbr.c,v 1.7 2006/01/02 03:17:42 bress Exp $
+ * $Id: replsbr.c,v 1.8 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -291,11 +291,9 @@
int i = dst - buf;\
int n = last_dst - buf;\
bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\
- buf = realloc (buf, bufsiz);\
+ buf = mh_xrealloc (buf, bufsiz);\
dst = buf + i;\
last_dst = buf + n;\
- if (! buf)\
- adios (NULL, "formataddr: couldn't get buffer space");\
bufend = buf + bufsiz;\
}
Index: nmh/uip/rmm.c
diff -u nmh/uip/rmm.c:1.6 nmh/uip/rmm.c:1.7
--- nmh/uip/rmm.c:1.6 Mon Jan 2 03:17:42 2006
+++ nmh/uip/rmm.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* rmm.c -- remove a message(s)
*
- * $Id: rmm.c,v 1.6 2006/01/02 03:17:42 bress Exp $
+ * $Id: rmm.c,v 1.7 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -98,9 +98,8 @@
*/
if (nummsgs >= maxmsgs){
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/scan.c
diff -u nmh/uip/scan.c:1.11 nmh/uip/scan.c:1.12
--- nmh/uip/scan.c:1.11 Mon Jan 2 03:17:42 2006
+++ nmh/uip/scan.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* scan.c -- display a one-line "scan" listing of folder or messages
*
- * $Id: scan.c,v 1.11 2006/01/02 03:17:42 bress Exp $
+ * $Id: scan.c,v 1.12 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -177,9 +177,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
Index: nmh/uip/sendsbr.c
diff -u nmh/uip/sendsbr.c:1.8 nmh/uip/sendsbr.c:1.9
--- nmh/uip/sendsbr.c:1.8 Mon Jan 2 03:17:42 2006
+++ nmh/uip/sendsbr.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* sendsbr.c -- routines to help WhatNow/Send along
*
- * $Id: sendsbr.c,v 1.8 2006/01/02 03:17:42 bress Exp $
+ * $Id: sendsbr.c,v 1.9 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -360,8 +360,7 @@
}
if (++n >= field_size - 1) {
- if ((field = (char *)realloc((void *)field, field_size += 256)) ==
(char *)0)
- adios(NULL, "can't grow field buffer.");
+ field = (char *)mh_xrealloc((void *)field, field_size += 256);
p = field + n - 1;
}
Index: nmh/uip/sortm.c
diff -u nmh/uip/sortm.c:1.9 nmh/uip/sortm.c:1.10
--- nmh/uip/sortm.c:1.9 Mon Jan 2 03:17:42 2006
+++ nmh/uip/sortm.c Mon Jan 2 03:25:18 2006
@@ -2,7 +2,7 @@
/*
* sortm.c -- sort messages in a folder by date/time
*
- * $Id: sortm.c,v 1.9 2006/01/02 03:17:42 bress Exp $
+ * $Id: sortm.c,v 1.10 2006/01/02 03:25:18 bress Exp $
*
* This code is Copyright (c) 2002, by the authors of nmh. See the
* COPYRIGHT file in the root directory of the nmh distribution for
@@ -182,9 +182,8 @@
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nmh-commits] nmh ./ChangeLog h/utils.h sbr/brkstring.c sbr/f...,
Josh Bressers <=