NetworkAction *action;
double init_rate;
ActiveComm() : destination(nullptr),action(nullptr),init_rate(-1){};
- ~ActiveComm(){};
+ virtual ~ActiveComm() = default;
};
class IBNode{
//number of comms the node is receiving
int nbActiveCommsDown;
explicit IBNode(int id) : id(id),nbActiveCommsDown(0){};
- ~IBNode(){};
+ virtual ~IBNode() = default;
};
class XBT_PRIVATE NetworkIBModel : public NetworkSmpiModel {
#include "storage_interface.hpp"
#include "surf_private.h"
-#include "xbt/file.h" /* xbt_getline */
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/split.hpp>
XBT_CDEBUG(xbt_dict_cursor, "next element: %p", current);
}
- while (current == NULL && ++line <= cursor->dict->table_size) {
+ while (current == NULL && (line + 1) <= cursor->dict->table_size) {
+ line++;
XBT_CDEBUG(xbt_dict_cursor, "current is NULL, take the next line");
current = cursor->dict->table[line];
XBT_CDEBUG(xbt_dict_cursor, "element in the next line: %p", current);
*/
ssize_t xbt_getline(char **buf, size_t *n, FILE *stream)
{
- ssize_t i;
- int ch;
-
- ch = getc(stream);
+ int ch = getc(stream);
if (ferror(stream) || feof(stream))
return -1;
*buf = xbt_malloc(*n);
}
- i = 0;
+ ssize_t i = 0;
do {
- if (i == *n)
- *buf = xbt_realloc(*buf, *n += 512);
- (*buf)[i++] = ch;
+ if (i == *n) {
+ *n += 512;
+ *buf = xbt_realloc(*buf, *n);
+ }
+ (*buf)[i] = ch;
+ i++;
} while (ch != '\n' && (ch = getc(stream)) != EOF);
- if (i == *n)
- *buf = xbt_realloc(*buf, *n += 1);
+ if (i == *n) {
+ *n += 1;
+ *buf = xbt_realloc(*buf, *n);
+ }
(*buf)[i] = '\0';
return i;
/* I want the standard error to go below 0.1 second.
* Two tests at least will be run (count is not > 0) */
SMPI_SAMPLE_LOCAL(0, 0.1) {
- if (verbose || n++ < 2) {
+ if (verbose || n < 2) {
+ n++;
if (verbose)
fprintf(stderr, "(%12.6f)", MPI_Wtime());
else