[svn:parrot] r48187 - in branches/gsoc_nfg: include/parrot src/string/charset
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Tue Jul 27 19:01:40 UTC 2010
Author: darbelo
Date: Tue Jul 27 19:01:39 2010
New Revision: 48187
URL: https://trac.parrot.org/parrot/changeset/48187
Log:
Remove the various charset hashing functions, the encodings have been able to do that, and do it better, for some time now.
Modified:
branches/gsoc_nfg/include/parrot/charset.h
branches/gsoc_nfg/src/string/charset/ascii.c
branches/gsoc_nfg/src/string/charset/binary.c
branches/gsoc_nfg/src/string/charset/iso-8859-1.c
branches/gsoc_nfg/src/string/charset/unicode.c
Modified: branches/gsoc_nfg/include/parrot/charset.h
==============================================================================
--- branches/gsoc_nfg/include/parrot/charset.h Tue Jul 27 19:01:17 2010 (r48186)
+++ branches/gsoc_nfg/include/parrot/charset.h Tue Jul 27 19:01:39 2010 (r48187)
@@ -63,7 +63,6 @@
typedef INTVAL (*charset_find_not_newline_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset);
typedef INTVAL (*charset_find_word_boundary_t)(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset);
typedef STRING * (*charset_string_from_codepoint_t)(PARROT_INTERP, UINTVAL codepoint);
-typedef size_t (*charset_compute_hash_t)(PARROT_INTERP, ARGIN(const STRING *src), size_t seed);
typedef STRING * (*charset_converter_t)(PARROT_INTERP, ARGIN(const STRING *src));
@@ -230,7 +229,6 @@
charset_find_cclass_t find_cclass;
charset_find_not_cclass_t find_not_cclass;
charset_string_from_codepoint_t string_from_codepoint;
- charset_compute_hash_t compute_hash;
const ENCODING *preferred_encoding;
};
@@ -250,7 +248,6 @@
#define CHARSET_IS_CCLASS(interp, flags, source, offset) ((source)->charset)->is_cclass((interp), (flags), (source), (offset))
#define CHARSET_FIND_CCLASS(interp, flags, source, offset, count) ((source)->charset)->find_cclass((interp), (flags), (source), (offset), (count))
#define CHARSET_FIND_NOT_CCLASS(interp, flags, source, offset, count) ((source)->charset)->find_not_cclass((interp), (flags), (source), (offset), (count))
-#define CHARSET_COMPUTE_HASH(interp, source, seed) ((source)->charset)->compute_hash((interp), (source), (seed))
#define CHARSET_GET_PREFERRED_ENCODING(interp, source) ((source)->charset)->preferred_encoding
#endif /* PARROT_CHARSET_H_GUARD */
Modified: branches/gsoc_nfg/src/string/charset/ascii.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/ascii.c Tue Jul 27 19:01:17 2010 (r48186)
+++ branches/gsoc_nfg/src/string/charset/ascii.c Tue Jul 27 19:01:39 2010 (r48187)
@@ -736,35 +736,6 @@
/*
-=item C<size_t ascii_compute_hash(PARROT_INTERP, const STRING *src, size_t
-seed)>
-
-Computes the hash of STRING C<src> starting with seed value
-C<seed>.
-
-=cut
-
-*/
-
-PARROT_PURE_FUNCTION
-size_t
-ascii_compute_hash(SHIM_INTERP, ARGIN(const STRING *src), size_t seed)
-{
- ASSERT_ARGS(ascii_compute_hash)
- size_t hashval = seed;
- const char *buffptr = (const char *)src->strstart;
- UINTVAL len = src->strlen;
-
- PARROT_ASSERT(src->encoding == Parrot_fixed_8_encoding_ptr);
- while (len--) {
- hashval += hashval << 5;
- hashval += *buffptr++;
- }
- return hashval;
-}
-
-/*
-
=item C<void Parrot_charset_ascii_init(PARROT_INTERP)>
Initialize the ASCII charset but registering all the necessary
@@ -798,7 +769,6 @@
find_cclass,
find_not_cclass,
string_from_codepoint,
- ascii_compute_hash,
NULL
};
Modified: branches/gsoc_nfg/src/string/charset/binary.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/binary.c Tue Jul 27 19:01:17 2010 (r48186)
+++ branches/gsoc_nfg/src/string/charset/binary.c Tue Jul 27 19:01:39 2010 (r48187)
@@ -516,7 +516,6 @@
find_cclass,
find_not_cclass,
string_from_codepoint,
- ascii_compute_hash,
NULL
};
Modified: branches/gsoc_nfg/src/string/charset/iso-8859-1.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/iso-8859-1.c Tue Jul 27 19:01:17 2010 (r48186)
+++ branches/gsoc_nfg/src/string/charset/iso-8859-1.c Tue Jul 27 19:01:39 2010 (r48187)
@@ -673,7 +673,6 @@
find_cclass,
find_not_cclass,
string_from_codepoint,
- ascii_compute_hash,
NULL
};
Modified: branches/gsoc_nfg/src/string/charset/unicode.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/unicode.c Tue Jul 27 19:01:17 2010 (r48186)
+++ branches/gsoc_nfg/src/string/charset/unicode.c Tue Jul 27 19:01:39 2010 (r48187)
@@ -38,12 +38,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static size_t compute_hash(PARROT_INTERP,
- ARGIN(const STRING *src),
- size_t seed)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
static INTVAL cs_rindex(PARROT_INTERP,
SHIM(const STRING *src),
SHIM(const STRING *search_string),
@@ -127,9 +121,6 @@
#define ASSERT_ARGS_compose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(src))
-#define ASSERT_ARGS_compute_hash __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(src))
#define ASSERT_ARGS_cs_rindex __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_decompose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -963,38 +954,6 @@
return dest;
}
-
-/*
-
-=item C<static size_t compute_hash(PARROT_INTERP, const STRING *src, size_t
-seed)>
-
-Computes the hash of the given STRING C<src> with starting seed value C<seed>.
-
-=cut
-
-*/
-
-static size_t
-compute_hash(PARROT_INTERP, ARGIN(const STRING *src), size_t seed)
-{
- ASSERT_ARGS(compute_hash)
- String_iter iter;
- UINTVAL offs;
- size_t hashval = seed;
-
- ENCODING_ITER_INIT(interp, src, &iter);
-
- for (offs = 0; offs < src->strlen; ++offs) {
- const UINTVAL c = iter.get_and_advance(interp, &iter);
- hashval += hashval << 5;
- hashval += c;
- }
-
- return hashval;
-}
-
-
/*
=item C<void Parrot_charset_unicode_init(PARROT_INTERP)>
@@ -1030,7 +989,6 @@
find_cclass,
find_not_cclass,
string_from_codepoint,
- compute_hash,
NULL
};
More information about the parrot-commits
mailing list