Mercurial > hg > dmlib
changeset 1222:823f8e06ff6a
Rename some variables.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 06 Mar 2015 09:53:39 +0200 |
parents | e0aa979e7188 |
children | 82cc143cb7d2 |
files | minijss/jssmod.c |
diffstat | 1 files changed, 19 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/minijss/jssmod.c Fri Mar 06 09:52:20 2015 +0200 +++ b/minijss/jssmod.c Fri Mar 06 09:53:39 2015 +0200 @@ -374,7 +374,7 @@ JSSPattern *jssAllocatePattern(const int nrows, const int nchannels) { int row, chn; - JSSPattern *res; + JSSPattern *pattern; JSSNote *pnote; // Check arguments @@ -382,24 +382,23 @@ JSSERROR(DMERR_INVALID_ARGS, NULL, "Invalid nrows=%i or nchannels=%i.\n", nrows, nchannels); // Allocate a pattern structure - res = dmMalloc0(sizeof(JSSPattern)); - if (res == NULL) + if ((pattern = dmMalloc0(sizeof(JSSPattern))) == NULL) JSSERROR(DMERR_MALLOC, NULL, "Could not allocate pattern structure.\n"); // Allocate notedata - res->data = dmCalloc(nrows * nchannels, sizeof(JSSNote)); - if (res->data == NULL) + pattern->data = dmCalloc(nrows * nchannels, sizeof(JSSNote)); + if (pattern->data == NULL) { - dmFree(res); + dmFree(pattern); JSSERROR(DMERR_MALLOC, NULL, "Could not allocate pattern data (nrows=%i, nchannels=%i).\n", nrows, nchannels); } // Initialize - res->nrows = nrows; - res->nchannels = nchannels; + pattern->nrows = nrows; + pattern->nchannels = nchannels; - pnote = res->data; + pnote = pattern->data; for (row = 0; row < nrows; row++) { for (chn = 0; chn < nchannels; chn++) @@ -412,7 +411,8 @@ } // OK, return pointer to struct - return res; + return pattern; +} } @@ -420,14 +420,13 @@ */ JSSInstrument *jssAllocateInstrument(void) { - JSSInstrument *res; + JSSInstrument *inst; // Allocate a instrument structure - res = dmMalloc0(sizeof(JSSInstrument)); - if (res == NULL) + if ((inst = dmMalloc0(sizeof(JSSInstrument))) == NULL) return NULL; - return res; + return inst; } @@ -436,17 +435,18 @@ JSSExtInstrument *jssAllocateExtInstrument(void) { int i; - JSSExtInstrument *res; + JSSExtInstrument *inst; // Allocate a instrument structure - res = dmMalloc0(sizeof(JSSExtInstrument)); - if (res == NULL) + if ((inst = dmMalloc0(sizeof(JSSExtInstrument))) == NULL) return NULL; + // Initialize the requisite fields for (i = 0; i < jsetNNotes; i++) { - res->sNumForNotes[i] = jsetNotSet; + inst->sNumForNotes[i] = jsetNotSet; + inst->instConvTable[i] = jsetNotSet; } - return res; + return inst; }