# HG changeset patch # User Matti Hamalainen # Date 1425628419 -7200 # Node ID 823f8e06ff6a52c6e2bc39fce58ea05079905e91 # Parent e0aa979e7188742189e7c37713516d344331936a Rename some variables. diff -r e0aa979e7188 -r 823f8e06ff6a minijss/jssmod.c --- 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; }