Skip to content

Commit b60f9ab

Browse files
committed
Simplify interface of get_*_info, ... functions
We do not need to modify the string's buffer location but only the content.
1 parent 6d934ef commit b60f9ab

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

compile_info.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,96 +8,96 @@
88

99
#define MAX_INFO_STRING_LENGTH 1024
1010

11-
int get_compiler_info( char **info_str ) {
11+
int get_compiler_info( char *info_str ) {
1212
/* For compiler predfined macros used for identification see
1313
* http://predef.sourceforge.net/precomp.html
1414
*/
1515

1616
/* Cray compiler */
1717
#if defined(_CRAYC)
18-
sprintf( *info_str, "Cray %d.%d", _RELEASE, _RELEASE_MINOR );
18+
sprintf( info_str, "Cray %d.%d", _RELEASE, _RELEASE_MINOR );
1919
#endif
2020

2121
/* GNU compiler */
2222
#if defined(__GNUC__)
2323
# if defined(__GNUC_PATCHLEVEL__)
24-
sprintf( *info_str, "GNU %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ );
24+
sprintf( info_str, "GNU %d.%d.%d", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__ );
2525
# else
26-
sprintf( *info_str, "GNU %d.%d", __GNUC__, __GNUC_MINOR__ );
26+
sprintf( info_str, "GNU %d.%d", __GNUC__, __GNUC_MINOR__ );
2727
# endif
2828

2929
/* Intel compiler */
3030
#elif defined(__INTEL_COMPILER)
3131
int version = (int) __INTEL_COMPILER / 100;
3232
int revision = ((int)__INTEL_COMPILER % 100) / 10;
3333
int patch = (int) __INTEL_COMPILER % 10;
34-
sprintf( *info_str, "Intel %d.%d.%d", version, revision, patch );
34+
sprintf( info_str, "Intel %d.%d.%d", version, revision, patch );
3535

3636
/* PGI compiler */
3737
#elif defined(__PGI)
38-
sprintf( *info_str, "PGI" );
38+
sprintf( info_str, "PGI" );
3939

4040
/* Sun compiler */
4141
#elif defined(__SUNPRO_C)
4242
int version = (__SUNPRO_C >> 12) & 0xf;
4343
int revision_digit1 = (__SUNPRO_C >> 8) & 0xf;
4444
int revision_digit2 = (__SUNPRO_C >> 4) & 0xf;
4545
int patch = (__SUNPRO_C >> 0 ) & 0xf;
46-
sprintf( *info_str, "Sun %d.%d%d.%d", version, revision_digit1, revision_digit2, patch );
46+
sprintf( info_str, "Sun %d.%d%d.%d", version, revision_digit1, revision_digit2, patch );
4747

4848
/* unknown */
4949
#else
50-
sprintf( *info_str, "unknown" );
50+
sprintf( info_str, "unknown" );
5151
#endif
5252

5353
return 0;
5454
}
5555

5656
#if defined(MPI_VERSION)
5757

58-
int get_mpi_info(char **info_str) {
58+
int get_mpi_info(char *info_str) {
5959
#if defined(MVAPICH2)
60-
sprintf(*info_str, "MVAPICH2");
60+
sprintf( info_str, "MVAPICH2");
6161
#elif defined(OPEN_MPI)
62-
sprintf(*info_str, "Open MPI");
62+
sprintf( info_str, "Open MPI");
6363
#elif defined(I_MPI_VERSION)
64-
sprintf(*info_str, "Intel MPI");
64+
sprintf( info_str, "Intel MPI");
6565
#elif defined(CRAY_MPI)
66-
sprintf(*info_str, "Cray MPI");
66+
sprintf( info_str, "Cray MPI");
6767
#elif defined(MPICH)
68-
sprintf(*info_str, "MPICH");
68+
sprintf( info_str, "MPICH");
6969
#else
70-
sprintf(*info_str, "unknown");
70+
sprintf( info_str, "unknown");
7171
#endif
7272
return 0;
7373
}
7474

7575
#endif
7676

7777

78-
int get_compile_time( char **info_str ) {
79-
sprintf( *info_str, "%s %s", __DATE__, __TIME__ );
78+
int get_compile_time( char *info_str ) {
79+
sprintf( info_str, "%s %s", __DATE__, __TIME__ );
8080
return 0;
8181
}
8282

8383

84-
int get_timestamp ( char **info_str ) {
84+
int get_timestamp ( char *info_str ) {
8585
time_t t;
8686
struct tm *ts;
8787
t = time(NULL);
8888
ts = localtime(&t);
89-
sprintf( *info_str, "D%d-%d-%d T%d:%d:%d",
89+
sprintf( info_str, "D%d-%d-%d T%d:%d:%d",
9090
ts->tm_mday, ts->tm_mon + 1, ts->tm_year + 1900,
9191
ts->tm_hour, ts->tm_min, ts->tm_sec );
9292
return 0;
9393
}
9494

9595

96-
int get_host( char **info_str ) {
96+
int get_host( char *info_str ) {
9797
char hostname[1024];
9898
hostname[1023] = '\0';
9999
gethostname(hostname, 1023 );
100-
sprintf( *info_str, "%s", hostname );
100+
sprintf( info_str, "%s", hostname );
101101
return 0;
102102
}
103103

mpi_test_suite.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ int main (int argc, char * argv[])
148148
tst_output_init (DEBUG_LOG, TST_OUTPUT_RANK_SELF, TST_REPORT_MAX, TST_OUTPUT_TYPE_LOGFILE, "tst.log");
149149

150150
char info_str[MAX_INFO_STRING_LENGTH];
151-
get_compiler_info(&info_str);
151+
get_compiler_info(info_str);
152152
tst_output_printf(DEBUG_LOG, TST_REPORT_RUN, "Compiler used was %s\n", info_str);
153-
get_mpi_info(&info_str);
153+
get_mpi_info(info_str);
154154
tst_output_printf(DEBUG_LOG, TST_REPORT_FULL, "MPI version used was %s\n", info_str);
155-
get_compile_time(&info_str);
155+
get_compile_time(info_str);
156156
tst_output_printf(DEBUG_LOG, TST_REPORT_FULL, "Compiled at %s\n", info_str);
157-
get_timestamp(&info_str);
157+
get_timestamp(info_str);
158158
tst_output_printf(DEBUG_LOG, TST_REPORT_FULL, "Started at %s\n", info_str);
159159
#ifndef HAVE_MPI2_THREADS
160160
tst_output_printf(DEBUG_LOG, TST_REPORT_FULL, "Testsuite was compiled without MPI2_THREADS");

0 commit comments

Comments
 (0)