Re: [evolution-patches] Trivial patch to add const to camel




> I used dd to dump the appropriate subsection of libcamel-1.2.so and sure
> enough, every string (and more) that you added const to is already in
> there :)

The strings are in .rodata, as "" creates a constant string literal.
The main use of the patch is to move arrays from .data into .rodata,
such as datetok_table (256 4-byte integers) and the mXXX set (a number
of 256 byte arrays).

Changing a char* into a const char[] doesn't change the storage of the
characters themselves, but the pointer.  A char* involves an extra
pointer initialisation and de-reference compared to a char[].  Feel free
to refuse the patches adding const to strings, but I feel they are
useful if only from a semantic point of view.  They are constant
strings. so should be marked as such.

I think the patch is basically worth it.  I'm not sure it will always do what you're intending, but it might (my c language in this area isn't that complete), and at worst, wont hurt any anyway.

In reality I doubt it makes a great deal of difference - copy on write pages, in a data section, never written to, wont need any more initialisation/io/cpu than a purely ro section (at least, as i understand it).  But I see no more problem with it, it does make the usage more concise.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]