Author: petdance
Date: Fri May 25 19:05:40 2007
New Revision: 18644
Modified:
trunk/include/parrot/encoding.h
trunk/include/parrot/string_funcs.h
trunk/src/hash.c
trunk/src/string.c
Log:
constant function pointers will make the world a better place.
Modified: trunk/include/parrot/encoding.h
==============================================================================
--- trunk/include/parrot/encoding.h (original)
+++ trunk/include/parrot/encoding.h Fri May 25 19:05:40 2007
@@ -90,35 +90,35 @@
PARROT_API const char * Parrot_encoding_c_name(Interp *, INTVAL
number_of_encoding);
#define ENCODING_MAX_BYTES_PER_CODEPOINT(i, src) \
- ((ENCODING *)src->encoding)->max_bytes_per_codepoint
+ ((const ENCODING *)src->encoding)->max_bytes_per_codepoint
#define ENCODING_GET_CODEPOINT(i, src, offset) \
- ((ENCODING *)src->encoding)->get_codepoint(i, src, offset)
+ ((const ENCODING *)src->encoding)->get_codepoint(i, src, offset)
#define ENCODING_SET_CODEPOINT(i, src, offset, codepoint) \
- ((ENCODING *)src->encoding)->set_codepoint(i, src, offset, codepoint)
+ ((const ENCODING *)src->encoding)->set_codepoint(i, src, offset, codepoint)
#define ENCODING_GET_BYTE(i, src, offset) \
- ((ENCODING *)src->encoding)->get_byte(i, src, offset)
+ ((const ENCODING *)src->encoding)->get_byte(i, src, offset)
#define ENCODING_SET_BYTE(i, src, offset, value) \
- ((ENCODING *)src->encoding)->set_byte(i, src, offset, value)
+ ((const ENCODING *)src->encoding)->set_byte(i, src, offset, value)
#define ENCODING_GET_CODEPOINTS(i, src, offset, count) \
- ((ENCODING *)src->encoding)->get_codepoints(i, src, offset, count)
+ ((const ENCODING *)src->encoding)->get_codepoints(i, src, offset, count)
#define ENCODING_GET_CODEPOINTS_INPLACE(i, src, offset, count, dest) \
- ((ENCODING *)src->encoding)->get_codepoints_inplace(i, src, offset, count,
dest)
+ ((const ENCODING *)src->encoding)->get_codepoints_inplace(i, src, offset,
count, dest)
#define ENCODING_GET_BYTES(i, src, offset, count) \
- ((ENCODING *)src->encoding)->get_bytes(i, src, offset, count)
+ ((const ENCODING *)src->encoding)->get_bytes(i, src, offset, count)
#define ENCODING_GET_BYTES_INPLACE(i, src, offset, count, dest) \
- ((ENCODING *)src->encoding)->get_bytes_inplace(i, src, offset, count, dest)
+ ((const ENCODING *)src->encoding)->get_bytes_inplace(i, src, offset,
count, dest)
#define ENCODING_SET_CODEPOINTS(i, src, offset, count, newdata) \
- ((ENCODING *)src->encoding)->set_codepoints(i, src, offset, count, newdata)
+ ((const ENCODING *)src->encoding)->set_codepoints(i, src, offset, count,
newdata)
#define ENCODING_SET_BYTES(i, src, offset, count, newdata) \
- ((ENCODING *)src->encoding)->set_bytes(i, src, offset, count, newdata)
+ ((const ENCODING *)src->encoding)->set_bytes(i, src, offset, count,
newdata)
#define ENCODING_BECOME_ENCODING(i, src) \
- ((ENCODING *)src->encoding)->become_encoding(i, src)
+ ((const ENCODING *)src->encoding)->become_encoding(i, src)
#define ENCODING_CODEPOINTS(i, src) \
- ((ENCODING *)src->encoding)->codepoints(i, src)
+ ((const ENCODING *)src->encoding)->codepoints(i, src)
#define ENCODING_BYTES(i, src) \
- ((ENCODING *)src->encoding)->bytes(i, src)
+ ((const ENCODING *)src->encoding)->bytes(i, src)
#define ENCODING_ITER_INIT(i, src, iter) \
- ((ENCODING *)src->encoding)->iter_init(i, src, iter)
+ ((const ENCODING *)src->encoding)->iter_init(i, src, iter)
#endif /* PARROT_ENCODING_H_GUARD */
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Fri May 25 19:05:40 2007
@@ -24,10 +24,10 @@
PARROT_API STRING *Parrot_reuse_COW_reference(Interp *, STRING *, STRING *);
PARROT_API STRING *Parrot_make_COW_reference(Interp *, STRING *);
PARROT_API void Parrot_unmake_COW(Interp *, STRING *);
-PARROT_API INTVAL string_compute_strlen(Interp *, STRING *);
-PARROT_API INTVAL string_max_bytes(Interp *, STRING*, INTVAL);
-PARROT_API STRING *string_concat(Interp *, STRING *, STRING *, UINTVAL);
-PARROT_API STRING *string_append(Interp *, STRING *, STRING *);
+PARROT_API INTVAL string_compute_strlen(Interp *, STRING *str);
+PARROT_API INTVAL string_max_bytes(Interp *, const STRING *str, INTVAL);
+PARROT_API STRING *string_concat(Interp *, STRING *str, STRING *appendage,
UINTVAL len);
+PARROT_API STRING *string_append(Interp *, STRING *str, STRING *appendage);
PARROT_API STRING *string_repeat(Interp *, const STRING *, UINTVAL,
STRING **);
PARROT_API STRING *string_chopn(Interp *, STRING *, INTVAL, int in_place);
@@ -39,9 +39,9 @@
STRING *, INTVAL, const char *, ...);
PARROT_API STRING *string_printf(Interp *interp,
const char *format, ...);
-PARROT_API INTVAL string_compare(Interp *, STRING *, STRING *);
+PARROT_API INTVAL string_compare(Interp *, const STRING *a, const STRING *b);
PARROT_API INTVAL string_equal(Interp *, const STRING *a, const STRING *b);
-PARROT_API INTVAL string_bool(Interp *, const STRING *);
+PARROT_API INTVAL string_bool(Interp *, const STRING *a);
PARROT_API STRING *string_increment(Interp *, const STRING *);
PARROT_API const char *Parrot_string_cstring(Interp *, const STRING *);
Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c (original)
+++ trunk/src/hash.c Fri May 25 19:05:40 2007
@@ -172,7 +172,7 @@
}
static int
-int_compare(Parrot_Interp interp, void *a, void *b)
+int_compare(Parrot_Interp interp, const void *a, const void *b)
{
UNUSED(interp);
return a != b;
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Fri May 25 19:05:40 2007
@@ -834,7 +834,7 @@
*/
INTVAL
-string_max_bytes(Interp *interp, STRING *s, INTVAL nchars)
+string_max_bytes(Interp *interp, const STRING *s, INTVAL nchars)
{
assert(s->encoding);
return ENCODING_MAX_BYTES_PER_CODEPOINT(interp, s) * nchars;
@@ -1202,7 +1202,7 @@
INTVAL
-string_compare(Interp *interp, STRING *s1, STRING *s2)
+string_compare(Interp *interp, const STRING *s1, const STRING *s2)
{
if (!s1 && !s2) {
return 0;