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
this one comes from ia64
[simgrid.git]
/
testsuite
/
xbt
/
dict_crash.c
diff --git
a/testsuite/xbt/dict_crash.c
b/testsuite/xbt/dict_crash.c
index
9b9058c
..
c16121f
100644
(file)
--- a/
testsuite/xbt/dict_crash.c
+++ b/
testsuite/xbt/dict_crash.c
@@
-22,7
+22,7
@@
static void print_str(void *str) {
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
XBT_LOG_NEW_DEFAULT_CATEGORY(test,"Logging specific to this test");
-static
xbt_error_t
traverse(xbt_dict_t head) {
+static
void
traverse(xbt_dict_t head) {
xbt_dict_cursor_t cursor=NULL;
char *key;
char *data;
xbt_dict_cursor_t cursor=NULL;
char *key;
char *data;
@@
-32,29
+32,27
@@
static xbt_error_t traverse(xbt_dict_t head) {
xbt_assert2 (!strcmp(key,data),
"Key(%s) != value(%s). Abording\n",key,data);
}
xbt_assert2 (!strcmp(key,data),
"Key(%s) != value(%s). Abording\n",key,data);
}
- return no_error;
}
}
-static
xbt_error_t countelems(xbt_dict_t head,int*count
) {
+static
int countelems(xbt_dict_t head
) {
xbt_dict_cursor_t cursor;
char *key;
void *data;
xbt_dict_cursor_t cursor;
char *key;
void *data;
-
*count=
0;
+
int res =
0;
xbt_dict_foreach(head,cursor,key,data) {
xbt_dict_foreach(head,cursor,key,data) {
-
(*count)
++;
+
res
++;
}
}
- return
no_error
;
+ return
res
;
}
int main(int argc,char **argv) {
}
int main(int argc,char **argv) {
- xbt_error_t errcode;
xbt_dict_t head=NULL;
int i,j,k, nb;
char *key;
void *data;
xbt_dict_t head=NULL;
int i,j,k, nb;
char *key;
void *data;
- xbt_init
_defaultlog(&argc,argv,"dict.thresh=verbose"
);
+ xbt_init
(&argc,argv
);
srand((unsigned int)time(NULL));
printf("Dictionnary: CRASH test:\n");
srand((unsigned int)time(NULL));
printf("Dictionnary: CRASH test:\n");
@@
-78,14
+76,13
@@
int main(int argc,char **argv) {
/* printf("[%d %s]\n",j,key); */
xbt_dict_set(head,key,key,&free);
}
/* printf("[%d %s]\n",j,key); */
xbt_dict_set(head,key,key,&free);
}
- nb=0;
/* xbt_dict_dump(head,(void (*)(void*))&printf); */
/* xbt_dict_dump(head,(void (*)(void*))&printf); */
-
TRYFAIL(countelems(head,&nb)
);
+
nb = countelems(head
);
if (nb != 1000) {
printf ("\nI found %d elements, and not 1000\n",nb);
abort();
}
if (nb != 1000) {
printf ("\nI found %d elements, and not 1000\n",nb);
abort();
}
-
TRYFAIL(traverse(head)
);
+
traverse(head
);
xbt_dict_free(&head);
xbt_dict_free(&head);
}
xbt_dict_free(&head);
xbt_dict_free(&head);
}
@@
-109,7
+106,7
@@
int main(int argc,char **argv) {
}
printf("\n Count the elements (retrieving the key and data for each): \n");
}
printf("\n Count the elements (retrieving the key and data for each): \n");
-
TRYFAIL(countelems(head,&i)
);
+
i = countelems(head
);
printf(" There is %d elements\n",i);
printf("\n Search my 20 000 elements 20 times. (a point is a test)\n");
printf(" There is %d elements\n",i);
printf("\n Search my 20 000 elements 20 times. (a point is a test)\n");
@@
-122,7
+119,7
@@
int main(int argc,char **argv) {
for (j=0;j<NB_ELM;j++) {
sprintf(key,"%d",j);
for (j=0;j<NB_ELM;j++) {
sprintf(key,"%d",j);
-
TRYFAIL(xbt_dict_get(head,key,&data)
);
+
data = xbt_dict_get(head,key
);
if (strcmp(key,(char*)data)) {
printf("key=%s != data=%s\n",key,(char*)data);
abort();
if (strcmp(key,(char*)data)) {
printf("key=%s != data=%s\n",key,(char*)data);
abort();
@@
-140,7
+137,7
@@
int main(int argc,char **argv) {
if (!(j%10000)) printf("."); fflush(stdout);
sprintf(key,"%d",j);
if (!(j%10000)) printf("."); fflush(stdout);
sprintf(key,"%d",j);
-
TRYFAIL(xbt_dict_remove(head,key)
);
+
xbt_dict_remove(head,key
);
}
printf("\n");
free(key);
}
printf("\n");
free(key);