Review Request: Use const-ref in foreach where possible

Friedrich W. H. Kossebau kossebau at kde.org
Fri Dec 28 20:02:02 GMT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107990/
-----------------------------------------------------------

Review request for Calligra.


Description
-------

Motivated by the big number of "chances for improvements" reported by krazy for Calligra code and needing a break, here now have some more little code-cleanup.

Basically s/foreach(T t, tList)/foreach(const T &t, tList)/, with some careful looking at each case.

Not always in hot paths, but code gets copied around, so let's have all blueprints using the optimal code, it's only a small footprint and also helps with preventing any unwanted assignments/modifications to the loop value.

Any expensive keys() calls with QMap/QHash are ignored in this patch.
Ignored are also any usages with Q*Shared*Ptr-based types, no real idea what is better, creating another pointer instance or using a const-ref to the original pointer, hints welcome.


Diffs
-----

  active/src/MainWindow.cpp 372761e 
  filters/sheets/excel/sidewinder/objects.cpp ccbbffd 
  filters/sheets/html/htmlimport.cc cb58365 
  filters/sheets/xlsx/XlsxXmlWorksheetReader.cpp 99c3eb5 
  filters/words/epub/OdtHtmlConverter.cpp d4b7199 
  filters/words/epub/exportepub2.cpp 84d8a90 
  filters/words/epub/exporthtml.cpp bdd33e7 
  filters/words/mobi/OdtMobiHtmlConverter.cpp 936679d 
  filters/words/mobi/exportmobi.cpp 662f4c3 
  kexi/core/kexiactionproxy.cpp 6b56384 
  kexi/core/kexiprojectdata.cpp 912255b 
  kexi/core/kexitemplateloader.cpp dfae6bf 
  kexi/formeditor/connectiondialog.cpp a3f48f9 
  kexi/formeditor/widgetwithsubpropertiesinterface.cpp e57001e 
  kexi/main/startup/KexiStartup.cpp 0b23a1a 
  kexi/plugins/scripting/kexidb/kexidbmodule.cpp a282ce0 
  kexi/plugins/scripting/kexiscripting/kexiscriptdesignview.cpp 4c405bb 
  kexi/widget/fields/KexiFieldListModel.cpp 3c17ce0 
  kexi/widget/fields/KexiFieldListView.cpp 591178e 
  kexi/widget/kexicharencodingcombobox.cpp f33ceab 
  kexi/widget/kexidbdrivercombobox.cpp b8e6641 
  krita/image/brushengine/kis_paintop_registry.cc fc88b08 
  krita/image/kis_filter_strategy.cc 1e397d7 
  krita/image/kis_math_toolbox.cpp 8f465cb 
  krita/image/kis_paint_layer.cc af16df2 
  krita/image/metadata/kis_meta_data_filter_registry.cc e459524 
  krita/image/metadata/kis_meta_data_filter_registry_model.cc 172d5fc 
  krita/image/metadata/kis_meta_data_io_backend.cc 6462b18 
  krita/image/metadata/kis_meta_data_merge_strategy_registry.cc c908560 
  krita/image/recorder/kis_recorded_action_factory_registry.cc 8303f98 
  krita/image/recorder/kis_recorded_path_paint_action.cpp c145c35 
  krita/image/tests/kis_walkers_test.cpp d806c87 
  krita/image/tiles3/kis_memento_manager.cc 4c4d8f6 
  krita/plugins/extensions/imagesplit/imagesplit.cpp 49d3454 
  krita/plugins/filters/phongbumpmap/phong_pixel_processor.cpp 3d0eac0 
  krita/plugins/paintops/libbrush/kis_brush_registry.cpp 44b7671 
  krita/plugins/paintops/libpaintop/kis_pressure_opacity_option.cpp ac2efbc 
  krita/plugins/paintops/mypaint/mypaint_brush_resource.cpp 8d6d557 
  krita/plugins/tools/selectiontools/kis_tool_select_magnetic.cc 33d6da7 
  krita/ui/canvas/kis_prescaled_projection.cpp 2d7c541 
  krita/ui/kis_node_model.cpp cd320f9 
  krita/ui/kis_painting_assistant.cc 1f619f2 
  krita/ui/kis_ui_action_factory_registry.cpp ba9b221 
  krita/ui/kis_view2.cpp 193a466 
  krita/ui/kisexiv2/kis_iptc_io.cpp aaab941 
  krita/ui/recorder/kis_recorded_action_creator_factory_registry.cc 3325d8c 
  krita/ui/widgets/kis_color_space_selector.cc cfa9f8c 
  krita/ui/widgets/kis_custom_image_widget.cc 42adf70 
  krita/ui/widgets/kis_preset_selector_strip.cpp 9c1bd52 
  libs/db/connection.cpp 97f1234 
  libs/flake/KoInputDeviceHandlerRegistry.cpp ff89ac6 
  libs/kopageapp/KoPAView.cpp af15c5d 
  libs/kotext/BibliographyGenerator.cpp 15808cb 
  libs/kotext/KoTextRdfCore.cpp 3cf32be 
  libs/kotext/ToCBibGeneratorInfo.cpp 26462da 
  libs/kotext/opendocument/KoTextWriter_p.cpp c302522 
  libs/main/KoFindText.cpp fd4a691 
  libs/main/KoModeBox.cpp fc2852f 
  libs/main/KoProgressUpdater.cpp 37d148d 
  libs/main/KoView.cpp 8fbdf1c 
  libs/odf/KoCellValue.cpp 0c9b379 
  libs/odf/KoOdfBibliographyConfiguration.cpp ed567d1 
  libs/odf/KoShadowStyle.cpp 801116c 
  libs/textlayout/KoTextLayoutArea.cpp e672b37 
  libs/textlayout/RunAroundHelper.cpp 18b4247 
  libs/widgets/KoCsvImportDialog.cpp 08fb839 
  libs/widgets/KoResourceServerProvider.cpp 2d927dc 
  libs/widgets/KoResourceTagging.cpp 85049e4 
  plan/libs/kernel/kptschedule.cpp 3a81227 
  plan/libs/kernel/kptschedulerplugin.cpp 5771222 
  plugins/chartshape/tests/odf/TestLoadingBase.cpp ede37aa0 
  plugins/musicshape/core/tests/MusicXmlWriterTest.cpp 7a41bb0 
  plugins/staging/googledocs/googledocumentservice.cpp 0a34ffc 
  plugins/textshape/TextTool.cpp 148806c 
  plugins/textshape/dialogs/BibliographyConfigureDialog.cpp bed2c6b 
  plugins/textshape/dialogs/BibliographyTemplate.cpp 03fc0e1 
  plugins/textshape/dialogs/InsertBibliographyDialog.cpp 0ab89fa 
  plugins/textshape/dialogs/SimpleParagraphWidget.cpp 7a9b191 
  sheets/DependencyManager.cpp 60e82e8 
  sheets/FunctionModuleRegistry.cpp 6aa2dd2 
  sheets/StyleManager.cpp 0754afc 
  sheets/commands/AutoFillCommand.cpp 41601e7 
  sheets/part/dialogs/SheetSelectPage.cpp 7858bfb 
  sheets/plugins/scripting/ScriptingPart.cpp e606c69 
  sheets/plugins/scripting/ScriptingWidgets.cpp cd11b3b 
  sheets/plugins/solver/Solver.cpp 8cb4290 
  stage/part/KPrCustomSlideShows.cpp e23fd90 
  stage/part/KPrCustomSlideShowsModel.cpp 9870494 
  stage/part/animations/strategy/KPrSmilValues.cpp 25e4f97 
  stage/part/commands/KPrDeleteSlidesCommand.cpp 3cf536a 
  words/part/KWDocument.cpp 3298086 
  words/part/KWOdfWriter.cpp f209e0c 
  words/part/KWView.cpp a992bde 

Diff: http://git.reviewboard.kde.org/r/107990/diff/


Testing
-------

No changes in tests.


Thanks,

Friedrich W. H. Kossebau

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20121228/ae617019/attachment.htm>


More information about the calligra-devel mailing list