Navigation Menu

Skip to content

Commit

Permalink
Remove now-unused MVM_string_flatten function.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Nov 16, 2016
1 parent 1dc68e5 commit 9d5c874
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
36 changes: 0 additions & 36 deletions src/strings/ops.c
Expand Up @@ -1210,42 +1210,6 @@ MVMint64 MVM_string_offset_has_unicode_property_value(MVMThreadContext *tc, MVMS
return MVM_unicode_codepoint_has_property_value(tc, cp, property_code, property_value_code);
}

/* Normalizes a string to a flat MVMGrapheme32 buffer, for the benefit of
* hashing. Would rather not have to do this eventually. */
void MVM_string_flatten(MVMThreadContext *tc, MVMString *s) {
MVM_string_check_arg(tc, s, "flatten");
switch (s->body.storage_type) {
case MVM_STRING_GRAPHEME_32:
return;
case MVM_STRING_GRAPHEME_ASCII:
case MVM_STRING_GRAPHEME_8: {
MVMuint32 length = MVM_string_graphs(tc, s);
MVMGrapheme32 *flat = MVM_malloc(length * sizeof(MVMGrapheme32));
MVMGrapheme8 *orig = s->body.storage.blob_8;
MVMuint32 i;
for (i = 0; i < length; i++)
flat[i] = orig[i];
s->body.storage.blob_32 = flat;
s->body.storage_type = MVM_STRING_GRAPHEME_32;
MVM_free(orig);
break;
}
case MVM_STRING_STRAND: {
MVMGrapheme32 *flat = MVM_malloc(MVM_string_graphs(tc, s) * sizeof(MVMGrapheme32));
MVMStringStrand *orig = s->body.storage.strands;
MVMuint32 i = 0;
MVMGraphemeIter gi;
MVM_string_gi_init(tc, &gi, s);
while (MVM_string_gi_has_more(tc, &gi))
flat[i++] = MVM_string_gi_get_grapheme(tc, &gi);
s->body.storage.blob_32 = flat;
s->body.storage_type = MVM_STRING_GRAPHEME_32;
MVM_free(orig);
break;
}
}
}

/* If the string is made up of strands, then produces a flattend string
* representing the exact same graphemes but without strands. Otherwise,
* returns the input string. Intended for strings that will be indexed
Expand Down
1 change: 0 additions & 1 deletion src/strings/ops.h
Expand Up @@ -78,7 +78,6 @@ const char * MVM_unicode_codepoint_get_property_cstr(MVMThreadContext *tc, MVMGr
MVMint64 MVM_unicode_codepoint_get_property_int(MVMThreadContext *tc, MVMGrapheme32 grapheme, MVMint64 property_code);
MVMint64 MVM_unicode_codepoint_get_property_bool(MVMThreadContext *tc, MVMGrapheme32 grapheme, MVMint64 property_code);
MVMString * MVM_unicode_get_name(MVMThreadContext *tc, MVMint64 grapheme);
void MVM_string_flatten(MVMThreadContext *tc, MVMString *s);
MVMString * MVM_string_indexing_optimized(MVMThreadContext *tc, MVMString *s);
MVMString * MVM_string_escape(MVMThreadContext *tc, MVMString *s);
MVMString * MVM_string_flip(MVMThreadContext *tc, MVMString *s);
Expand Down

0 comments on commit 9d5c874

Please sign in to comment.