Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > PriorityQueue
diff PriorityQueue.c @ 3:500d0e2fabfb
made pure C and added .brch__defaul and eol handling
| author | Me@portablequad |
|---|---|
| date | Sat, 11 Feb 2012 20:27:13 -0800 |
| parents | 4d8a1e0f4336 |
| children |
line diff
1.1 --- a/PriorityQueue.c Thu Feb 09 15:55:54 2012 +0100 1.2 +++ b/PriorityQueue.c Sat Feb 11 20:27:13 2012 -0800 1.3 @@ -5,25 +5,12 @@ 1.4 * Author: hausers@cs.tu-berlin.de 1.5 */ 1.6 1.7 -#include <limits.h> 1.8 -#include <stdio.h> 1.9 -#include <string.h> 1.10 - 1.11 #include "PriorityQueue.h" 1.12 -#ifndef DEBUG 1.13 -#include "../../VMS_Implementations/VMS_impl/vmalloc.h" 1.14 -#endif 1.15 1.16 #define left(i) 2*i 1.17 #define right(i) 2*i+1 1.18 #define parent(i) i/2 1.19 1.20 -#ifdef DEBUG 1.21 -#include <stdlib.h> 1.22 -#define VMS__malloc malloc 1.23 -#define VMS__free free 1.24 -#endif 1.25 - 1.26 void swap (PrioQueueStruc *Q, int a, int b) { 1.27 void *valTmp; 1.28 int keyTmp; 1.29 @@ -69,21 +56,21 @@ 1.30 newSize= 2*oldSize; 1.31 1.32 Q->maxSize= newSize; 1.33 - newData= VMS__malloc(Q->maxSize*sizeof(heapNode)); 1.34 + newData= malloc(Q->maxSize*sizeof(heapNode)); 1.35 oldData= Q->data; 1.36 1.37 memcpy(newData,oldData,Q->maxSize*sizeof(heapNode)); 1.38 Q->data= newData; 1.39 1.40 - VMS__free(oldData); 1.41 + free(oldData); 1.42 } 1.43 1.44 1.45 -PrioQueueStruc* makeVMSPrioQ () { 1.46 +PrioQueueStruc* makePrioQ () { 1.47 PrioQueueStruc *retQ; 1.48 - retQ= VMS__malloc(sizeof(PrioQueueStruc)); 1.49 + retQ= malloc(sizeof(PrioQueueStruc)); 1.50 retQ->maxSize= 1024; 1.51 - retQ->data= VMS__malloc(retQ->maxSize*sizeof(heapNode)); 1.52 + retQ->data= malloc(retQ->maxSize*sizeof(heapNode)); 1.53 retQ->size= 0; 1.54 return retQ; 1.55 } 1.56 @@ -124,6 +111,6 @@ 1.57 } 1.58 1.59 void freePrioQ (PrioQueueStruc *Q) { 1.60 - VMS__free(Q->data); 1.61 - VMS__free(Q); 1.62 + free(Q->data); 1.63 + free(Q); 1.64 }
