/***************************************
- $Header: /home/amb/routino/src/RCS/sorting.c,v 1.8 2010/04/09 15:15:02 amb Exp $
+ $Header: /home/amb/routino/src/RCS/sorting.c,v 1.11 2010/09/25 13:54:18 amb Exp $
Merge sort functions.
Part of the Routino routing software.
******************/ /******************
- This file Copyright 2009 Andrew M. Bishop
+ This file Copyright 2009-2010 Andrew M. Bishop
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
#include <string.h>
#include <assert.h>
+#include "files.h"
#include "functions.h"
/* Sort the data pointers using a heap sort */
- heapsort(datap,n,compare);
+ filesort_heapsort(datap,n,compare);
/* Shortcut if all read in and sorted at once */
sprintf(filename,"%s/filesort.%d.tmp",option_tmpdirname,nfiles);
- fd=OpenFile(filename);
+ fd=OpenFileNew(filename);
for(i=0;i<n;i++)
WriteFile(fd,datap[i],itemsize);
/* Sort the data pointers using a heap sort */
- heapsort(datap,n,compare);
+ filesort_heapsort(datap,n,compare);
/* Shortcut if all read in and sorted at once */
sprintf(filename,"%s/filesort.%d.tmp",option_tmpdirname,nfiles);
- fd=OpenFile(filename);
+ fd=OpenFileNew(filename);
for(i=0;i<n;i++)
{
data to be sorted was an array of things not pointers).
++++++++++++++++++++++++++++++++++++++*/
-void heapsort(void **datap,size_t nitems,int(*compare)(const void*, const void*))
+void filesort_heapsort(void **datap,size_t nitems,int(*compare)(const void*, const void*))
{
int i;