1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-21 19:20:21 +02:00

misc: Make jit_note and related functions take a const argument

Make jit_memcpy, jit_memmove, jit_data take const pointers to
allow jit_note to be used with a const string (e.g. a string
literal, __FILE__ or __func__). This is needed for GNU Smalltalk
to silence compiler warnings.

Sadly "const jit_pointer_t" is not the same as "typedef const void *"
so I introduced a new typedef for a const jit pointer. The other
option would be to replace jit_pointer_t with void*.
This commit is contained in:
Holger Hans Peter Freyther 2014-10-26 22:21:42 +01:00 committed by pcpa
parent 44519452d9
commit 2229200c44
5 changed files with 12 additions and 11 deletions

View file

@ -44,7 +44,7 @@
/*
* Prototypes
*/
static jit_word_t hash_data(jit_pointer_t, jit_word_t);
static jit_word_t hash_data(jit_const_pointer_t, jit_word_t);
#define new_pool() _new_pool(_jit)
static void _new_pool(jit_state_t*);
@ -536,9 +536,9 @@ _jit_load(jit_state_t *_jit, jit_int32_t reg)
}
static jit_word_t
hash_data(jit_pointer_t data, jit_word_t length)
hash_data(jit_const_pointer_t data, jit_word_t length)
{
jit_uint8_t *ptr;
const jit_uint8_t *ptr;
jit_word_t i, key;
for (i = key = 0, ptr = data; i < length; i++)
key = (key << (key & 1)) ^ ptr[i];
@ -558,7 +558,7 @@ _jit_address(jit_state_t *_jit, jit_node_t *node)
}
jit_node_t *
_jit_data(jit_state_t *_jit, jit_pointer_t data,
_jit_data(jit_state_t *_jit, jit_const_pointer_t data,
jit_word_t length, jit_int32_t align)
{
jit_word_t key;