diff options
author | Benedikt Meurer <benedikt.meurer@googlemail.com> | 2012-12-29 10:41:08 +0000 |
---|---|---|
committer | Benedikt Meurer <benedikt.meurer@googlemail.com> | 2012-12-29 10:41:08 +0000 |
commit | b04d8284f0ce84d237cadf8ff5aabc060890613f (patch) | |
tree | f44b7273a42c0473e03b6b9f9c701147fdd1a33e | |
parent | 21735ad37520e466ff6b32474964d3206ab4dbef (diff) |
Fix several C compiler warnings.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13171 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | byterun/extern.c | 3 | ||||
-rw-r--r-- | byterun/gc_ctrl.c | 9 | ||||
-rw-r--r-- | byterun/intern.c | 44 |
3 files changed, 30 insertions, 26 deletions
diff --git a/byterun/extern.c b/byterun/extern.c index 4fb806840..4e96bc4c4 100644 --- a/byterun/extern.c +++ b/byterun/extern.c @@ -583,13 +583,12 @@ static intnat extern_value(value v, value flags) void caml_output_val(struct channel *chan, value v, value flags) { - intnat len; struct output_block * blk, * nextblk; if (! caml_channel_binary_mode(chan)) caml_failwith("output_value: not a binary channel"); init_extern_output(); - len = extern_value(v, flags); + extern_value(v, flags); /* During [caml_really_putblock], concurrent [caml_output_val] operations can take place (via signal handlers or context switching in systhreads), and [extern_output_first] may change. So, save it in a local variable. */ diff --git a/byterun/gc_ctrl.c b/byterun/gc_ctrl.c index 8950bb662..07cfc26d2 100644 --- a/byterun/gc_ctrl.c +++ b/byterun/gc_ctrl.c @@ -127,7 +127,10 @@ static value heap_stats (int returnstats) free_words = 0, free_blocks = 0, largest_free = 0, fragments = 0, heap_chunks = 0; char *chunk = caml_heap_start, *chunk_end; - char *cur_hp, *prev_hp; + char *cur_hp; +#ifdef DEBUG + char *prev_hp; +#endif header_t cur_hd; #ifdef DEBUG @@ -137,7 +140,9 @@ static value heap_stats (int returnstats) while (chunk != NULL){ ++ heap_chunks; chunk_end = chunk + Chunk_size (chunk); +#ifdef DEBUG prev_hp = NULL; +#endif cur_hp = chunk; while (cur_hp < chunk_end){ cur_hd = Hd_hp (cur_hp); @@ -192,7 +197,9 @@ static value heap_stats (int returnstats) */ break; } +#ifdef DEBUG prev_hp = cur_hp; +#endif cur_hp = Next (cur_hp); } Assert (cur_hp == chunk_end); chunk = Chunk_next (chunk); diff --git a/byterun/intern.c b/byterun/intern.c index 5487ee665..f45a2c120 100644 --- a/byterun/intern.c +++ b/byterun/intern.c @@ -567,7 +567,7 @@ static void intern_add_to_heap(mlsize_t whsize) value caml_input_val(struct channel *chan) { uint32 magic; - mlsize_t block_len, num_objects, size_32, size_64, whsize; + mlsize_t block_len, num_objects, whsize; char * block; value res; @@ -577,8 +577,13 @@ value caml_input_val(struct channel *chan) if (magic != Intext_magic_number) caml_failwith("input_value: bad object"); block_len = caml_getword(chan); num_objects = caml_getword(chan); - size_32 = caml_getword(chan); - size_64 = caml_getword(chan); +#ifdef ARCH_SIXTYFOUR + caml_getword(chan); /* skip size_32 */ + whsize = caml_getword(chan); +#else + whsize = caml_getword(chan); + caml_getword(chan); /* skip size_64 */ +#endif /* Read block from channel */ block = caml_stat_alloc(block_len); /* During [caml_really_getblock], concurrent [caml_input_val] operations @@ -592,12 +597,6 @@ value caml_input_val(struct channel *chan) intern_input = (unsigned char *) block; intern_input_malloced = 1; intern_src = intern_input; - /* Allocate result */ -#ifdef ARCH_SIXTYFOUR - whsize = size_64; -#else - whsize = size_32; -#endif intern_alloc(whsize, num_objects); /* Fill it in */ intern_rec(&res); @@ -623,20 +622,20 @@ CAMLprim value caml_input_value(value vchan) CAMLexport value caml_input_val_from_string(value str, intnat ofs) { CAMLparam1 (str); - mlsize_t num_objects, size_32, size_64, whsize; + mlsize_t num_objects, whsize; CAMLlocal1 (obj); intern_src = &Byte_u(str, ofs + 2*4); intern_input_malloced = 0; num_objects = read32u(); - size_32 = read32u(); - size_64 = read32u(); - /* Allocate result */ #ifdef ARCH_SIXTYFOUR - whsize = size_64; + intern_src += 4; /* skip size_32 */ + whsize = read32u(); #else - whsize = size_32; + whsize = read32u(); + intern_src += 4; /* skip size_64 */ #endif + /* Allocate result */ intern_alloc(whsize, num_objects); intern_src = &Byte_u(str, ofs + 5*4); /* If a GC occurred */ /* Fill it in */ @@ -654,18 +653,18 @@ CAMLprim value caml_input_value_from_string(value str, value ofs) static value input_val_from_block(void) { - mlsize_t num_objects, size_32, size_64, whsize; + mlsize_t num_objects, whsize; value obj; num_objects = read32u(); - size_32 = read32u(); - size_64 = read32u(); - /* Allocate result */ #ifdef ARCH_SIXTYFOUR - whsize = size_64; + intern_src += 4; /* skip size_32 */ + whsize = read32u(); #else - whsize = size_32; + whsize = read32u(); + intern_src += 4; /* skip size_64 */ #endif + /* Allocate result */ intern_alloc(whsize, num_objects); /* Fill it in */ intern_rec(&obj); @@ -678,7 +677,6 @@ static value input_val_from_block(void) CAMLexport value caml_input_value_from_malloc(char * data, intnat ofs) { uint32 magic; - mlsize_t block_len; value obj; intern_input = (unsigned char *) data; @@ -687,7 +685,7 @@ CAMLexport value caml_input_value_from_malloc(char * data, intnat ofs) magic = read32u(); if (magic != Intext_magic_number) caml_failwith("input_value_from_malloc: bad object"); - block_len = read32u(); + intern_src += 4; /* Skip block_len */ obj = input_val_from_block(); /* Free the input */ caml_stat_free(intern_input); |