On Thu, Mar 11, 2010 at 3:33 PM, Sebastian Dransfeld
<sebas...@tango.flipp.net> wrote:
>>>  static int
>>> +strcmplen(const void *data1, const void *data2)
>>> +{
>>> +    return strncmp(data1, data2, strlen(data2));
>>> +}
>>
>> If you used stringshare, you could use much faster eina_stringshare_len() 
>> here.
>
> Well, since one of the parameters isn't stringshared, it can't be done.

You can/should have all parameters stringshared. If you can
stringshare add, then query, then unref if required.


>>> +            unsigned int size = *(unsigned int *)p;
>>> +            p += sizeof(unsigned int);
>>> +            user_dirs = eina_list_append(user_dirs, strdup(p));
>>
>> by using eina_stringshare_add_length() here, you could avoid implicit
>> strlen() inside strdup(), and also get the length for almost 0 cost at
>> strcmplen...
>
> Same problem as above.
>
>>
>>
>>> +        if (ftruncate(dirsfd, 0) < 0) goto error;
>>
>> I'd not truncate it, never... truncation is basically useless, and
>> dangerous for mmaped resources.
>>
>
> It is unmapped before the truncate. And how to I clear the content of a
> file without truncate?

unlink()? :-)


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to