[Kst] kdeextragear-2/kst/plugins/demo

George Staikos staikos at kde.org
Thu May 22 05:39:22 CEST 2003


CVS commit by staikos: 

update the plugins to reflect the new memory scheme


  M +6 -1      cosdemo.c   1.2
  M +6 -1      sindemo.c   1.3


--- kdeextragear-2/kst/plugins/demo/cosdemo.c  #1.1:1.2
@@ -12,5 +12,10 @@ int cosdemo(const double *const inArrays
 
         for (i = 0; i < 2; i++) {
+                if (outArrayLens[i] != inArrayLens[i]) {
+                        outArrays[i] = realloc(outArrays[i],
+                                                inArrayLens[i]*sizeof(double));
                 outArrayLens[i] = inArrayLens[i];
+                }
+
                 for (j = 0; j < inArrayLens[i]; j++) {
                         outArrays[i][j] = cos(inArrays[i][j]);

--- kdeextragear-2/kst/plugins/demo/sindemo.c  #1.2:1.3
@@ -12,5 +12,10 @@ int sindemo(const double *const inArrays
 
         for (i = 0; i < 2; i++) {
+                if (outArrayLens[i] != inArrayLens[i]) {
+                        outArrays[i] = realloc(outArrays[i],
+                                                inArrayLens[i]*sizeof(double));
                 outArrayLens[i] = inArrayLens[i];
+                }
+
                 for (j = 0; j < inArrayLens[i]; j++) {
                         outArrays[i][j] = sin(inArrays[i][j]);




More information about the Kst mailing list