(trunk, libT) #5201 'tr_variantDict can be much faster' -- don't test to see if each dictionary value that's a string is a quark... it almost never is, so the lookup isn't worth it.

This commit is contained in:
Jordan Lee 2012-12-28 23:46:34 +00:00
parent 8f918f1b79
commit 765ed4a0d2
1 changed files with 1 additions and 8 deletions

View File

@ -117,7 +117,6 @@ tr_variant_string_set_string (struct tr_variant_string * str,
const char * bytes,
int len)
{
tr_quark quark;
tr_variant_string_clear (str);
if (bytes == NULL)
@ -125,13 +124,7 @@ tr_variant_string_set_string (struct tr_variant_string * str,
else if (len < 0)
len = strlen (bytes);
if (tr_quark_lookup (bytes, len, &quark))
{
str->type = TR_STRING_TYPE_QUARK;
str->quark = quark;
str->str.str = tr_quark_get_string (quark, &str->len);
}
else if ((size_t)len < sizeof(str->str.buf))
if ((size_t)len < sizeof(str->str.buf))
{
str->type = TR_STRING_TYPE_BUF;
memcpy (str->str.buf, bytes, len);