Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi Julien,

On Sun, 2012-01-08 at 03:25 -0800, julien2412 wrote:
For the file desktop/unx/source/file_image_unx.c, cppcheck tells :
line 120 is : w.m_size -= w.m_size;
Either this is right and it could be simplified with w.m_size = 0
or it's wrong and what should it be ?
(this time no overload operator trick since it's plain C :-) )

        Assign to zero - it's fine ;-)

93    unreadVariable  style   Variable 'c' is assigned a value that is never used

line 93 is : volatile char c = 0
Should this variable just be removed or c should be used in a way ?

        This is in fact deliberate; I'd add a comment in the source:

        /* force touching of each page despite the optimizer */

        The basic problem is that we memory map the file, and then want to
force each page in turn into memory - the issue with that is that we
don't really care what is there; so we do this bogus XOR sum in 'c' -
but without the volatile clever compilers will realise that this is not
doing anything and optimise it all away - so we will touch no pages, and
the I/O will not get done, and 'pagein' becomes a no-op ;-)

For both of them, if there's a easy fix, I suppose I may commit/push it on
master, but on branch 3.5 too ?

        Best to have cleanups just on master I think unless they are bug fixes.

        Anyhow - thanks for catching this :-)

        All the best,

                Michael.

-- 
michael.meeks@suse.com  <><, Pseudo Engineer, itinerant idiot


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.