Bug 38831 - Get rid of SV_DECL_VARARR, SV_DECL_VARARR_PLAIN, SV_DECL_VARARR_SORT ....
Summary: Get rid of SV_DECL_VARARR, SV_DECL_VARARR_PLAIN, SV_DECL_VARARR_SORT ....
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2011-06-30 09:04 UTC by Björn Michaelsen
Modified: 2015-12-15 16:27 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Michaelsen 2011-06-30 09:04:34 UTC
Get rid of SV_DECL_VARARR, SV_DECL_VARARR_PLAIN, SV_DECL_VARARR_SORT ....

Background: Similar to the above DECLARE_LIST macro, these macros were created before the STL became available. We need to rid our code base of these pesky macros once and for all. See svl/inc/svl/svarray.hxx for the definitions of these macros and svstdarr.hxx for declarations of the arrays.

In short, the following data types are defined via these macros:

    SvBytes - Done (Nigel Hawkins)
    SvBools - Done (Nigel Hawkins)
    SvLongs - Done (Nigel Hawkins)
    SvlongsSort - Done (Nigel Hawkins)
    SvULongs
    SvULongsSort - Done (Nigel Hawkins)
    SvShorts - Done (Nigel Hawkins)
    SvUShorts
    SvUShortsSort - Done (Nigel Hawkins)
    SvXub_StrLens - This is now just a typedef for std::deque<xub_StrLen>
    SvXub_StrLensSort - Done (Unused?)
    SvStrings
    SvStringsDtor
    SvStringsSort
    SvStringsSortDtor
    SvStringsISort
    SvStringsISortDtor
    SvByteStrings
    SvByteStringsDtor
    SvByteStringsSort
    SvByteStringsSortDtor
    SvByteStringsISort
    SvByteStringsISortDtor 

Note that some of these data structures appear to store pointers (the string versions, possibly others) and some manage the life cycle of stored elements. The xxxDtor versions certainly do this. Other versions should be checked (look for calling delete on the stored pointers before the pointers get removed). So, do take extra care not to leak memory when replacing them with new data structures. Replacing them with boost's ptr_container family may be a good strategy.

The following macros are used in pair:

    SV_DECL_PTRARR_SORT and SV_IMPL_OP_PTRARR_SORT
    SV_DECL_PTRARR_DEL and SV_IMPL_PTRARR 

and they are used A LOT! Let's remove them. For the most part, they are used as simple arrays that manage stored instances, so replacing them with boost's ptr_vector may be a good strategy. If the elements need to be sorted, we could use ptr_set or ptr_map.

There is also a copy of these macros and definitions inside binfilter. See

    binfilter/inc/bf_svtools/svarray.hxx
    binfilter/inc/bf_svtools/svstdarr.hxx
    binfilter/bf_svtools/source/memtools/svt_svarray.cxx 

for details. These should probably be ignored as binfilter is a snapshot of a very old build and is only used to open old staroffice files. If you do feel like fixing these, you may need to check if these differ from the svl versions.

Skills: building, simple C++, care in re-factoring
Comment 1 Maciej Rumianowski 2011-10-04 07:46:56 UTC
Done SV_ULongs

Working on WW8Bytes
Comment 2 Caolán McNamara 2011-11-01 06:22:00 UTC
Done SvUShorts, now with Daniel Di Marco's last SvUShorts patch
Comment 3 Caolán McNamara 2011-11-09 08:55:51 UTC
SvStringsSortDtor gone now with Daisuke Nishino's last patch
Comment 4 Florian Reisinger 2012-05-18 08:57:24 UTC
Deteted "Easyhack" from summary
Comment 5 David Tardon 2012-08-16 08:45:39 UTC
this is an ex-parrot
Comment 6 Robinson Tryon (qubit) 2015-12-15 16:27:26 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
[NinjaEdit]