summaryrefslogtreecommitdiff
path: root/src/slices.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/slices.c')
-rw-r--r--src/slices.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/slices.c b/src/slices.c
index d077454..e84facf 100644
--- a/src/slices.c
+++ b/src/slices.c
@@ -1,13 +1,10 @@
-#include <string.h>
#include "slices.h"
-//for perror
-#include <stdio.h>
-
-//FIXME : avoir une méthode destroy pour les slices qui free le mutex
+#include <string.h>
+#include <stdio.h> /* For perror() */
-inline int min(int a, int b) { return (a<b)?a:b; }
-inline int max(int a, int b) { return (a>b)?a:b; }
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
slice_t *sliceNew(address_t begin, address_t end, sliceStatus_t status, slice_t *next) {
slice_t *s;
@@ -221,8 +218,8 @@ char *slicesDump(slices_t *slices, address_t *blockSize, unsigned int charCount,
if ( (curr->begin >= begin && curr->begin <=end) || ( curr->end >= end && curr->end <= end ) ) {
// Draw the slice on the right number of characters
- sb=max(0, (curr->begin - begin) / *blockSize);
- se=min((curr->end - begin) / *blockSize, charCount-1);
+ sb=MAX(0, (curr->begin - begin) / *blockSize);
+ se=MIN((curr->end - begin) / *blockSize, charCount-1);
// Debug assertion
if (sb >= charCount || se >= charCount) {