From 0bfc482371bf63c4c312c749ba0bfc50483772ba Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Fri, 3 Feb 2012 10:15:19 +0100 Subject: [PATCH] Syntactic and comment changes. --- sbr/folder_free.c | 2 +- sbr/folder_read.c | 6 +++--- sbr/folder_realloc.c | 3 ++- sbr/utils.c | 5 +++-- uip/picksbr.c | 6 ++++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/sbr/folder_free.c b/sbr/folder_free.c index d383d78..2930254 100644 --- a/sbr/folder_free.c +++ b/sbr/folder_free.c @@ -24,6 +24,6 @@ folder_free(struct msgs *mp) for (i = 0; mp->msgattrs[i]; i++) free(mp->msgattrs[i]); - free(mp->msgstats); /* free message status area */ + free(mp->msgstats); /* free message status area */ free(mp); /* free main folder structure */ } diff --git a/sbr/folder_read.c b/sbr/folder_read.c index 5195592..8ccffc5 100644 --- a/sbr/folder_read.c +++ b/sbr/folder_read.c @@ -138,14 +138,14 @@ folder_read(char *name) /* for testing, allocate minimal necessary space */ /* mp->hghoff = max(mp->hghmsg, 1); */ - /* - ** Allocate space for status of each message. - */ + /* Allocate space for status of each message. */ + mp->msgstats = mh_xmalloc(MSGSTATSIZE(mp, mp->lowoff, mp->hghoff)); /* ** Clear all the flag bits for all the message ** status entries we just allocated. + ** TODO: use memset() ? */ for (msgnum = mp->lowoff; msgnum <= mp->hghoff; msgnum++) clear_msg_flags(mp, msgnum); diff --git a/sbr/folder_realloc.c b/sbr/folder_realloc.c index f1b703f..e69b833 100644 --- a/sbr/folder_realloc.c +++ b/sbr/folder_realloc.c @@ -57,8 +57,9 @@ folder_realloc(struct msgs *mp, int lo, int hi) /* then copy messages status array with shift */ if (mp->nummsg > 0) { - for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) + for (msgnum=mp->lowmsg; msgnum<=mp->hghmsg; msgnum++) { tmpstats[msgnum - lo] = mp->msgstats[msgnum - mp->lowoff]; + } } free(mp->msgstats); mp->msgstats = tmpstats; diff --git a/sbr/utils.c b/sbr/utils.c index 1cd3dc9..641a75d 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -45,11 +45,12 @@ mh_xrealloc(void *ptr, size_t size) void *memory; /* Some non-POSIX realloc()s don't cope with realloc(NULL,sz) */ - if (!ptr) + if (!ptr) { return mh_xmalloc(size); + } if (size == 0) - adios(NULL, "Tried to realloc 0bytes"); + adios(NULL, "Tried to realloc 0 bytes"); memory = realloc(ptr, size); if (!memory) diff --git a/uip/picksbr.c b/uip/picksbr.c index e021055..872e18a 100644 --- a/uip/picksbr.c +++ b/uip/picksbr.c @@ -946,8 +946,10 @@ plist case FLD: case FLDEOF: case FLDPLUS: - if (bp != NULL) - free(bp), bp = NULL; + if (bp != NULL) { + free(bp); + bp = NULL; + } bp = getcpy(buf); while (state == FLDPLUS) { state = m_getfld(state, name, buf, -- 1.7.10.4