From: markus schnalke Date: Fri, 3 Feb 2012 09:15:19 +0000 (+0100) Subject: Syntactic and comment changes. X-Git-Tag: mmh-thesis-end~381 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=0bfc482371bf63c4c312c749ba0bfc50483772ba;p=mmh Syntactic and comment changes. --- 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,