A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sonar smells.
[simgrid.git]
/
teshsuite
/
xbt
/
mmalloc
/
mmalloc_test.cpp
diff --git
a/teshsuite/xbt/mmalloc/mmalloc_test.cpp
b/teshsuite/xbt/mmalloc/mmalloc_test.cpp
index
9217257
..
fd9e809
100644
(file)
--- a/
teshsuite/xbt/mmalloc/mmalloc_test.cpp
+++ b/
teshsuite/xbt/mmalloc/mmalloc_test.cpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2012-20
19
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2012-20
20
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-7,6
+7,7
@@
#include "xbt.h"
#include "xbt/mmalloc.h"
#include "xbt.h"
#include "xbt/mmalloc.h"
+#include <array>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstdlib>
@@
-14,6
+15,7
@@
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <vector>
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"this test");
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"this test");
@@
-32,14
+34,14
@@
static void check_block(const unsigned char* p, unsigned char b, int n)
int main(int argc, char**argv)
{
xbt_mheap_t heapA = nullptr;
int main(int argc, char**argv)
{
xbt_mheap_t heapA = nullptr;
-
void *pointers[TESTSIZE]
;
+
std::array<void*, TESTSIZE> pointers
;
xbt_init(&argc,argv);
XBT_INFO("Allocating a new heap");
unsigned long mask = ~((unsigned long)xbt_pagesize - 1);
xbt_init(&argc,argv);
XBT_INFO("Allocating a new heap");
unsigned long mask = ~((unsigned long)xbt_pagesize - 1);
-
void *addr = (void*)
(((unsigned long)sbrk(0) + BUFFSIZE) & mask);
+
auto* addr = reinterpret_cast<void*>
(((unsigned long)sbrk(0) + BUFFSIZE) & mask);
heapA = xbt_mheap_new(-1, addr);
heapA = xbt_mheap_new(-1, addr);
- if (heapA ==
NULL
) {
+ if (heapA ==
nullptr
) {
perror("attach 1 failed");
fprintf(stderr, "bye\n");
exit(1);
perror("attach 1 failed");
fprintf(stderr, "bye\n");
exit(1);