mirror of
https://github.com/transmission/transmission
synced 2025-02-15 19:04:45 +00:00
(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:
parent
8f918f1b79
commit
765ed4a0d2
1 changed files with 1 additions and 8 deletions
|
@ -117,7 +117,6 @@ tr_variant_string_set_string (struct tr_variant_string * str,
|
||||||
const char * bytes,
|
const char * bytes,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
tr_quark quark;
|
|
||||||
tr_variant_string_clear (str);
|
tr_variant_string_clear (str);
|
||||||
|
|
||||||
if (bytes == NULL)
|
if (bytes == NULL)
|
||||||
|
@ -125,13 +124,7 @@ tr_variant_string_set_string (struct tr_variant_string * str,
|
||||||
else if (len < 0)
|
else if (len < 0)
|
||||||
len = strlen (bytes);
|
len = strlen (bytes);
|
||||||
|
|
||||||
if (tr_quark_lookup (bytes, len, &quark))
|
if ((size_t)len < sizeof(str->str.buf))
|
||||||
{
|
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
str->type = TR_STRING_TYPE_BUF;
|
str->type = TR_STRING_TYPE_BUF;
|
||||||
memcpy (str->str.buf, bytes, len);
|
memcpy (str->str.buf, bytes, len);
|
||||||
|
|
Loading…
Reference in a new issue