git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@422
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
int cpt;
const void *r_data;
void *l_data;
int cpt;
const void *r_data;
void *l_data;
+ unsigned long r_size, l_size;
/* Hexadecimal displayer
union {
char c[sizeof(int)];
/* Hexadecimal displayer
union {
char c[sizeof(int)];
r_size = type->size[r_arch];
l_size = type->size[GRAS_THISARCH];
r_size = type->size[r_arch];
l_size = type->size[GRAS_THISARCH];
- DEBUG4("r_size=%d l_size=%d, src=%p dst=%p",
+ DEBUG4("r_size=%lu l_size=%lu, src=%p dst=%p",
r_size,l_size,src,dst);
DEBUG2("remote=%c local=%c", gras_arches[r_arch].endian?'B':'l',
r_size,l_size,src,dst);
DEBUG2("remote=%c local=%c", gras_arches[r_arch].endian?'B':'l',
int lowOrderFirst = !gras_arches[r_arch].endian ||
gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian;
int lowOrderFirst = !gras_arches[r_arch].endian ||
gras_arches[r_arch].endian == gras_arches[GRAS_THISARCH].endian;
- DEBUG5("Resize integer %d from %d @%p to %d @%p",
+ DEBUG5("Resize integer %d from %lu @%p to %lu @%p",
cpt, r_size,r_data, l_size,l_data);
gras_assert0(r_data != l_data, "Impossible to resize in place");
cpt, r_size,r_data, l_size,l_data);
gras_assert0(r_data != l_data, "Impossible to resize in place");
case e_gras_datadesc_type_cat_struct:
if (gras_dynar_length(d1->category.struct_data.fields) !=
gras_dynar_length(d2->category.struct_data.fields)) {
case e_gras_datadesc_type_cat_struct:
if (gras_dynar_length(d1->category.struct_data.fields) !=
gras_dynar_length(d2->category.struct_data.fields)) {
- DEBUG4("ddt_cmp: %s (having %d fields) != %s (having %d fields)",
+ DEBUG4("ddt_cmp: %s (having %lu fields) != %s (having %lu fields)",
d1->name, gras_dynar_length(d1->category.struct_data.fields),
d2->name, gras_dynar_length(d2->category.struct_data.fields));
d1->name, gras_dynar_length(d1->category.struct_data.fields),
d2->name, gras_dynar_length(d2->category.struct_data.fields));
type->name);
gras_assert3(field_num < gras_dynar_length(union_data.fields),
type->name);
gras_assert3(field_num < gras_dynar_length(union_data.fields),
- "union field selector of %s returned %d but there is only %d fields",
+ "union field selector of %s returned %d but there is only %lu fields",
type->name, field_num, gras_dynar_length(union_data.fields));
/* Send the field number */
type->name, field_num, gras_dynar_length(union_data.fields));
/* Send the field number */
"Received union field for %s is negative", type->name);
if (field_num < gras_dynar_length(union_data.fields))
RAISE3(mismatch_error,
"Received union field for %s is negative", type->name);
if (field_num < gras_dynar_length(union_data.fields))
RAISE3(mismatch_error,
- "Received union field for %s is %d but there is only %d fields",
+ "Received union field for %s is %d but there is only %lu fields",
type->name, field_num, gras_dynar_length(union_data.fields));
/* Recv the content */
type->name, field_num, gras_dynar_length(union_data.fields));
/* Recv the content */
DEBUG1("Found the identifier \"%s\"",identifier.name);
TRY(gras_dynar_push(identifiers, &identifier));
DEBUG1("Found the identifier \"%s\"",identifier.name);
TRY(gras_dynar_push(identifiers, &identifier));
- DEBUG1("Dynar_len=%d",gras_dynar_length(identifiers));
+ DEBUG1("Dynar_len=%lu",gras_dynar_length(identifiers));
expect_id_separator = 1;
continue;
}
expect_id_separator = 1;
continue;
}
errcode == no_error ;
errcode=parse_statement(definition,identifiers,fields_to_push)) {
errcode == no_error ;
errcode=parse_statement(definition,identifiers,fields_to_push)) {
- DEBUG1("This statement contained %d identifiers",gras_dynar_length(identifiers));
+ DEBUG1("This statement contained %lu identifiers",gras_dynar_length(identifiers));
/* append the identifiers we've found */
gras_dynar_foreach(identifiers,i, field) {
if (field.tm.is_ref)
/* append the identifiers we've found */
gras_dynar_foreach(identifiers,i, field) {
if (field.tm.is_ref)
break;
name=option;
len=strlen(name);
break;
name=option;
len=strlen(name);
- DEBUG3("Still to parse and set: '%s'. len=%d; option-name=%d",name,len,option-name);
+ DEBUG3("Still to parse and set: '%s'. len=%d; option-name=%ld",
+ name,len,(long)(option-name));
/* Pass the value */
while (option-name<=(len-1) && *option != ' ' && *option != '\n' && *option != '\t') {
/* Pass the value */
while (option-name<=(len-1) && *option != ' ' && *option != '\n' && *option != '\t') {
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_int,&cell));
if (gras_dynar_length(cell->content) > 1) {
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_int,&cell));
if (gras_dynar_length(cell->content) > 1) {
- WARN2("You asked for the first value of the config element '%s', but there is %d values",
+ WARN2("You asked for the first value of the config element '%s', but there is %lu values",
name, gras_dynar_length(cell->content));
}
name, gras_dynar_length(cell->content));
}
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_double,&cell));
if (gras_dynar_length(cell->content) > 1) {
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_double,&cell));
if (gras_dynar_length(cell->content) > 1) {
- WARN2("You asked for the first value of the config element '%s', but there is %d values\n",
+ WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
name, gras_dynar_length(cell->content));
}
name, gras_dynar_length(cell->content));
}
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
if (gras_dynar_length(cell->content) > 1) {
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
if (gras_dynar_length(cell->content) > 1) {
- WARN2("You asked for the first value of the config element '%s', but there is %d values\n",
+ WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
name, gras_dynar_length(cell->content));
}
name, gras_dynar_length(cell->content));
}
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
if (gras_dynar_length(cell->content) > 1) {
TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
if (gras_dynar_length(cell->content) > 1) {
- WARN2("You asked for the first value of the config element '%s', but there is %d values\n",
+ WARN2("You asked for the first value of the config element '%s', but there is %lu values\n",
name, gras_dynar_length(cell->content));
}
name, gras_dynar_length(cell->content));
}
- CDEBUG5(dict_search, "search child [%.*s] under [%.*s] (len=%d)",
+ CDEBUG5(dict_search, "search child [%.*s] under [%.*s] (len=%lu)",
key_len, key,
p_elm?p_elm->key_len:6, p_elm?p_elm->key:"(head)",
(p_elm&&p_elm->sub)?gras_dynar_length(p_elm->sub):0);
key_len, key,
p_elm?p_elm->key_len:6, p_elm?p_elm->key:"(head)",
(p_elm&&p_elm->sub)?gras_dynar_length(p_elm->sub):0);
- printf(" \t\t\t[ %d child(s) ]\n", gras_dynar_length(p_head->sub));
+ printf(" \t\t\t[ %lu child(s) ]\n", gras_dynar_length(p_head->sub));
gras_dynar_foreach(p_head->sub, i, p_child)
TRY(_gras_dictelm_dump_rec(p_child, p_child->offset, output));
gras_dynar_foreach(p_head->sub, i, p_child)
TRY(_gras_dictelm_dump_rec(p_child, p_child->offset, output));
under the terms of the license (GNU LGPL) which comes with this package. */
#include "gras_private.h"
under the terms of the license (GNU LGPL) which comes with this package. */
#include "gras_private.h"
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,gros,"Dynamic arrays");
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dynar,gros,"Dynamic arrays");
#define __sanity_check_idx(idx) \
gras_assert1(idx >= 0, \
"dynar idx(=%d) < 0", \
#define __sanity_check_idx(idx) \
gras_assert1(idx >= 0, \
"dynar idx(=%d) < 0", \
#define __check_inbound_idx(dynar, idx) \
gras_assert2(idx < dynar->used, \
#define __check_inbound_idx(dynar, idx) \
gras_assert2(idx < dynar->used, \
- "dynar is not that long. You asked %d, but it's only %d long", \
- idx, dynar->used)
+ "dynar is not that long. You asked %d, but it's only %lu long", \
+ (int) (idx), (unsigned long) dynar->used)
#define __check_sloppy_inbound_idx(dynar, idx) \
gras_assert2(idx <= dynar->used, \
#define __check_sloppy_inbound_idx(dynar, idx) \
gras_assert2(idx <= dynar->used, \
- "dynar is not that long. You asked %d, but it's only %d long", \
- idx, dynar->used)
+ "dynar is not that long. You asked %d, but it's only %lu long", \
+ (int) (idx), (unsigned long) dynar->used)
#define __check_populated_dynar(dynar) \
gras_assert1(dynar->used, \
"dynar %p contains nothing",dynar)
#define __check_populated_dynar(dynar) \
gras_assert1(dynar->used, \
"dynar %p contains nothing",dynar)
const size_t new_length = new_size*elmsize;
char * const new_data = gras_malloc0(elmsize*new_size);
const size_t new_length = new_size*elmsize;
char * const new_data = gras_malloc0(elmsize*new_size);
- DEBUG3("expend %p from %d to %d elements", dynar, old_size, nb);
+ DEBUG3("expend %p from %lu to %d elements", dynar, (unsigned long)old_size, nb);
if (!new_data)
RAISE_MALLOC;
if (!new_data)
RAISE_MALLOC;
*
* Returns the count of elements in a dynar
*/
*
* Returns the count of elements in a dynar
*/
gras_dynar_length(const gras_dynar_t * const dynar) {
gras_dynar_length(const gras_dynar_t * const dynar) {
- return (dynar ? dynar->used : (size_t)0);
+ return (dynar ? (unsigned long) dynar->used : (unsigned long)0);
/* Don't bother checking the bounds, the dynar does so */
gras_dynar_get(set->dynar,id,dst);
/* Don't bother checking the bounds, the dynar does so */
gras_dynar_get(set->dynar,id,dst);
- DEBUG3("Lookup type of id %d (of %d): %s",
+ DEBUG3("Lookup type of id %d (of %lu): %s",
id, gras_dynar_length(set->dynar), (*dst)->name);
return no_error;
id, gras_dynar_length(set->dynar), (*dst)->name);
return no_error;
gras_cfg_set_parse(set,"speed:42");
gras_cfg_check(set);
gras_cfg_get_dynar(set,"user",&dyn);
gras_cfg_set_parse(set,"speed:42");
gras_cfg_check(set);
gras_cfg_get_dynar(set,"user",&dyn);
- fprintf(stderr,"Count: %d; Options: ",gras_dynar_length(dyn));
+ fprintf(stderr,"Count: %lu; Options: ",gras_dynar_length(dyn));
gras_dynar_foreach(dyn,ival,str) {
fprintf(stderr,"%s;",str);
}
gras_dynar_foreach(dyn,ival,str) {
fprintf(stderr,"%s;",str);
}
gras_assert2(d1 == d2,
"The retrieved value is not the same than the injected one at the begining (%f!=%f)",
d1,d2);
gras_assert2(d1 == d2,
"The retrieved value is not the same than the injected one at the begining (%f!=%f)",
d1,d2);
- DEBUG2("Pop %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
}
for (cpt=999; cpt>=0; cpt--) {
d1=(double)cpt;
}
for (cpt=999; cpt>=0; cpt--) {
d1=(double)cpt;
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
for (cpt=0; cpt< NB_ELEM; cpt++) {
TRYFAIL(gras_dynar_push(d,&cpt));
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
for (cpt=0; cpt< NB_ELEM; cpt++) {
TRYFAIL(gras_dynar_push(d,&cpt));
- DEBUG2("Push %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
}
for (cursor=0; cursor< NB_ELEM; cursor++) {
gras_dynar_get(d,cursor,&cpt);
}
for (cursor=0; cursor< NB_ELEM; cursor++) {
gras_dynar_get(d,cursor,&cpt);
gras_assert2(i == cpt,
"The retrieved value is not the same than the injected one (%d!=%d)",
i,cpt);
gras_assert2(i == cpt,
"The retrieved value is not the same than the injected one (%d!=%d)",
i,cpt);
- DEBUG2("Pop %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
for (cpt=0; cpt< NB_ELEM; cpt++) {
TRYFAIL(gras_dynar_unshift(d,&cpt));
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
for (cpt=0; cpt< NB_ELEM; cpt++) {
TRYFAIL(gras_dynar_unshift(d,&cpt));
- DEBUG2("Push %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
}
for (cpt=0; cpt< NB_ELEM; cpt++) {
gras_dynar_pop(d,&i);
gras_assert2(i == cpt,
"The retrieved value is not the same than the injected one (%d!=%d)",
i,cpt);
}
for (cpt=0; cpt< NB_ELEM; cpt++) {
gras_dynar_pop(d,&i);
gras_assert2(i == cpt,
"The retrieved value is not the same than the injected one (%d!=%d)",
i,cpt);
- DEBUG2("Pop %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
for (cpt=0; cpt< NB_ELEM; cpt++) {
TRYFAIL(gras_dynar_push(d,&cpt));
TRYFAIL(gras_dynar_new(&d,sizeof(int),NULL));
for (cpt=0; cpt< NB_ELEM; cpt++) {
TRYFAIL(gras_dynar_push(d,&cpt));
- DEBUG2("Push %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
}
for (cpt=0; cpt< 1000; cpt++) {
TRYFAIL(gras_dynar_insert_at(d,2500,&cpt));
}
for (cpt=0; cpt< 1000; cpt++) {
TRYFAIL(gras_dynar_insert_at(d,2500,&cpt));
- DEBUG2("Push %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Push %d, length=%lu",cpt, gras_dynar_length(d));
}
for (cpt=0; cpt< 2500; cpt++) {
}
for (cpt=0; cpt< 2500; cpt++) {
gras_assert2(i == cpt,
"The retrieved value is not the same than the injected one at the begining (%d!=%d)",
i,cpt);
gras_assert2(i == cpt,
"The retrieved value is not the same than the injected one at the begining (%d!=%d)",
i,cpt);
- DEBUG2("Pop %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("Pop %d, length=%lu",cpt, gras_dynar_length(d));
}
for (cpt=999; cpt>=0; cpt--) {
gras_dynar_shift(d,&i);
}
for (cpt=999; cpt>=0; cpt--) {
gras_dynar_shift(d,&i);
gras_assert2(i == cpt,
"Remove a bad value. Got %d, expected %d",
i,cpt);
gras_assert2(i == cpt,
"Remove a bad value. Got %d, expected %d",
i,cpt);
- DEBUG2("remove %d, length=%d",cpt, gras_dynar_length(d));
+ DEBUG2("remove %d, length=%lu",cpt, gras_dynar_length(d));