From: Teemu Murtola Date: Thu, 2 Jul 2015 18:22:33 +0000 (+0300) Subject: Convert gmxfio to C++ X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=d49f8ff3087d792a94c6fba7461a3a9d4c5b839d;p=alexxy%2Fgromacs.git Convert gmxfio to C++ - Remove unused variables. - Add missing extern "C" in thread-MPI. Change-Id: I595f60ee27ab851e8c7c304b1f02a8f4aa15932f --- diff --git a/src/external/thread_mpi/include/thread_mpi/lock.h b/src/external/thread_mpi/include/thread_mpi/lock.h index f30e8bf740..84a9794fdd 100644 --- a/src/external/thread_mpi/include/thread_mpi/lock.h +++ b/src/external/thread_mpi/include/thread_mpi/lock.h @@ -42,6 +42,10 @@ #include "wait.h" #include "atomic.h" +#ifdef __cplusplus +extern "C" { +#endif + /** Fast (possibly busy-wait-based) lock type * * This lock type forms an intermediate between the spinlocks and mutexes: @@ -102,6 +106,8 @@ int tMPI_Lock_trylock(tMPI_Lock_t *lock); TMPI_EXPORT int tMPI_Lock_islocked(tMPI_Lock_t *lock); - +#ifdef __cplusplus +} +#endif #endif /* TMPI_FASTLOCK_H_ */ diff --git a/src/gromacs/fileio/gmxfio-xdr.c b/src/gromacs/fileio/gmxfio-xdr.cpp similarity index 100% rename from src/gromacs/fileio/gmxfio-xdr.c rename to src/gromacs/fileio/gmxfio-xdr.cpp diff --git a/src/gromacs/fileio/gmxfio.c b/src/gromacs/fileio/gmxfio.cpp similarity index 98% rename from src/gromacs/fileio/gmxfio.c rename to src/gromacs/fileio/gmxfio.cpp index 3f92499313..67ab811570 100644 --- a/src/gromacs/fileio/gmxfio.c +++ b/src/gromacs/fileio/gmxfio.cpp @@ -185,8 +185,6 @@ static void gmx_fio_insert(t_fileio *fio) NOTE: We also assume that the open_file_mutex has been locked */ static void gmx_fio_remove(t_fileio *fio) { - t_fileio *prev; - /* lock prev, because we're changing it */ gmx_fio_lock(fio->prev); @@ -275,10 +273,8 @@ static void gmx_fio_stop_getting_next(t_fileio *fio) t_fileio *gmx_fio_open(const char *fn, const char *mode) { t_fileio *fio = NULL; - int i; char newmode[5]; gmx_bool bRead, bReadWrite; - int xdrid; /* sanitize the mode string */ if (strncmp(mode, "r+", 2) == 0) @@ -464,7 +460,7 @@ int gmx_fio_fp_close(t_fileio *fio) FILE * gmx_fio_fopen(const char *fn, const char *mode) { - FILE *fp, *ret; + FILE *ret; t_fileio *fio; fio = gmx_fio_open(fn, mode); @@ -478,7 +474,6 @@ FILE * gmx_fio_fopen(const char *fn, const char *mode) int gmx_fio_fclose(FILE *fp) { t_fileio *cur; - t_fileio *found = NULL; int rc = -1; cur = gmx_fio_get_first(); @@ -608,8 +603,6 @@ int gmx_fio_get_file_md5(t_fileio *fio, gmx_off_t offset, /* The fio_mutex should ALWAYS be locked when this function is called */ static int gmx_fio_int_get_file_position(t_fileio *fio, gmx_off_t *offset) { - char buf[STRLEN]; - /* Flush the file, so we are sure it is written */ if (gmx_fio_int_flush(fio)) { @@ -635,11 +628,8 @@ static int gmx_fio_int_get_file_position(t_fileio *fio, gmx_off_t *offset) int gmx_fio_get_output_file_positions(gmx_file_position_t **p_outputfiles, int *p_nfiles) { - int i, nfiles, rc, nalloc; - int pos_hi, pos_lo; - long pos; + int nfiles, nalloc; gmx_file_position_t * outputfiles; - char buf[STRLEN]; t_fileio *cur; nfiles = 0; @@ -655,7 +645,6 @@ int gmx_fio_get_output_file_positions(gmx_file_position_t **p_outputfiles, we call this routine... */ if (cur->bOpen && !cur->bRead && cur->iFTP != efCPT) { - int ret; /* This is an output file currently open for writing, add it */ if (nfiles == nalloc) { @@ -754,8 +743,6 @@ int gmx_fio_flush(t_fileio* fio) static int gmx_fio_int_fsync(t_fileio *fio) { int rc = 0; - int filen = -1; - if (fio->fp) {