156   long i;

157  

158   for (i = 0; i < _LISTSIZE; i++)

159    temp[i] = _LIST[i];

160  

161   free(_LIST);

162  

163   _LIST = temp;

164   _LISTSIZE = 2 * _LISTSIZE;

165  }

166  

167  // now add to end:

168  _LIST[ _LISTCOUNT] = l;

169  _LISTCOUNT++;

170 }

171  

172 // compare function for qsort below:

173 int _compare(const void *a1, const void *a2)

174 {

175  long l1, l2;

176  l1 = *((long *)a1);

177  l2 = *((long *)a2);

178  

179  // for ascending order, return positive if l1 > l2:

180  if (l1 > l2)

181   return 1;

182  else if (l1 == l2)

183   return 0;

184  else

185   return -1;

186 }

187  

188 void SortList()

189 {

190  qsort(_LIST, _LISTCOUNT, sizeof(long), _compare);

191 }

192  

193 void DumpList()

194 {

195  //

196  // dumps first ...

Get Multicore Software Development Techniques now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.