2
2
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3
3
* University Research and Technology
4
4
* Corporation. All rights reserved.
5
- * Copyright (c) 2004-2016 The University of Tennessee and The University
5
+ * Copyright (c) 2004-2020 The University of Tennessee and The University
6
6
* of Tennessee Research Foundation. All rights
7
7
* reserved.
8
8
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -268,7 +268,7 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
268
268
} else {
269
269
scount = rcount = OMPI_COMM_IS_INTER (comm )?ompi_comm_remote_size (comm ):ompi_comm_size (comm );
270
270
}
271
-
271
+
272
272
for (int i = 0 ; i < scount ; i ++ ) {
273
273
if (NULL != stypes && NULL != stypes [i ] && !ompi_datatype_is_predefined (stypes [i ])) {
274
274
OBJ_RETAIN (stypes [i ]);
@@ -297,7 +297,8 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req,
297
297
return OMPI_SUCCESS ;
298
298
}
299
299
300
- static void nbc_req_cons (ompi_coll_base_nbc_request_t * req ) {
300
+ static void nbc_req_cons (ompi_coll_base_nbc_request_t * req )
301
+ {
301
302
req -> cb .req_complete_cb = NULL ;
302
303
req -> req_complete_cb_data = NULL ;
303
304
req -> data .objs .objs [0 ] = NULL ;
@@ -309,35 +310,67 @@ OBJ_CLASS_INSTANCE(ompi_coll_base_nbc_request_t, ompi_request_t, nbc_req_cons, N
309
310
/* File reading functions */
310
311
static void skiptonewline (FILE * fptr , int * fileline )
311
312
{
312
- do {
313
- char val ;
314
- int rc ;
313
+ char val ;
314
+ int rc ;
315
315
316
+ do {
316
317
rc = fread (& val , 1 , 1 , fptr );
317
- if (0 == rc ) return ;
318
- if ((1 == rc )&& ('\n' == val )) {
318
+ if (0 == rc ) {
319
+ return ;
320
+ }
321
+ if ('\n' == val ) {
319
322
(* fileline )++ ;
320
323
return ;
321
- }
324
+ }
322
325
} while (1 );
323
326
}
324
327
325
- long ompi_coll_base_file_getnext (FILE * fptr , int * fileline )
328
+ int ompi_coll_base_file_getnext_long (FILE * fptr , int * fileline , long * val )
326
329
{
330
+ char trash ;
331
+ int rc ;
332
+
327
333
do {
328
- long val ;
329
- int rc ;
330
- char trash ;
334
+ rc = fscanf (fptr , "%li" , val );
335
+ if (rc == EOF ) {
336
+ return -1 ;
337
+ }
338
+ if (1 == rc ) {
339
+ return 0 ;
340
+ }
341
+ /* in all other cases, skip to the end of the token */
342
+ rc = fread (& trash , sizeof (char ), 1 , fptr );
343
+ if (rc == EOF ) {
344
+ return -1 ;
345
+ }
346
+ if ('\n' == trash ) (* fileline )++ ;
347
+ if ('#' == trash ) {
348
+ skiptonewline (fptr , fileline );
349
+ }
350
+ } while (1 );
351
+ }
352
+
353
+ int ompi_coll_base_file_getnext_size_t (FILE * fptr , int * fileline , size_t * val )
354
+ {
355
+ char trash ;
356
+ int rc ;
331
357
332
- rc = fscanf (fptr , "%li" , & val );
333
- if (rc == EOF ) return MYEOF ;
334
- if (1 == rc ) return val ;
335
- /* in all other cases, skip to the end */
358
+ do {
359
+ rc = fscanf (fptr , "%" PRIsize_t , val );
360
+ if (rc == EOF ) {
361
+ return -1 ;
362
+ }
363
+ if (1 == rc ) {
364
+ return 0 ;
365
+ }
366
+ /* in all other cases, skip to the end of the token */
336
367
rc = fread (& trash , sizeof (char ), 1 , fptr );
337
- if (rc == EOF ) return MYEOF ;
368
+ if (rc == EOF ) {
369
+ return -1 ;
370
+ }
338
371
if ('\n' == trash ) (* fileline )++ ;
339
372
if ('#' == trash ) {
340
373
skiptonewline (fptr , fileline );
341
- }
374
+ }
342
375
} while (1 );
343
376
}
0 commit comments