diff minijss/jssmod.c @ 1224:e667710aee8e

Add functions jssFreeInstrument(), jssFreeExtInstrument() and jssFreePattern().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 06 Mar 2015 09:56:21 +0200
parents 823f8e06ff6a
children a4a9ce298cdd
line wrap: on
line diff
--- a/minijss/jssmod.c	Fri Mar 06 09:54:30 2015 +0200
+++ b/minijss/jssmod.c	Fri Mar 06 09:56:21 2015 +0200
@@ -413,6 +413,15 @@
     // OK, return pointer to struct
     return pattern;
 }
+
+
+void jssFreePattern(JSSPattern *pattern)
+{
+    if (pattern != NULL)
+    {
+        dmFree(pattern->data);
+        dmFree(pattern);
+    }
 }
 
 
@@ -430,6 +439,19 @@
 }
 
 
+void jssFreeInstrument(JSSInstrument *inst)
+{
+    if (inst != NULL)
+    {
+#ifndef JSS_LIGHT
+        dmFree(inst->desc);
+#endif
+        dmFree(inst->data);
+        dmFree(inst);
+    }
+}
+
+
 /* Allocates and initializes "extended" instrument structure.
  */
 JSSExtInstrument *jssAllocateExtInstrument(void)
@@ -450,3 +472,15 @@
 
     return inst;
 }
+
+
+void jssFreeExtInstrument(JSSExtInstrument *inst)
+{
+    if (inst != NULL)
+    {
+#ifndef JSS_LIGHT
+        dmFree(inst->desc);
+#endif
+        dmFree(inst);
+    }
+}