mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
eb47b2a8d8
So this is totally unrelated to the git repository format, except for the fact that I noticed it while writing the git saving code. The subsurface divetag list handling is being stupid, and has a initial dummy entry at the head of the list for no good reason. I say "no good reason", because there *is* a reason for it: it allows code to avoid the special case of empty list and adding entries to before the first entry etc etc. But that reason is a really *bad* reason, because it's valid only because people don't understand basic list manipulation and pointers to pointers. So get rid of the dummy element, and do things right instead - by passing a *pointer* to the list, instead of the list. And then when traversing the list and looking for a place to insert things, don't go to the next entry - just update the "pointer to pointer" to point to the address of the next entry. Each entry in a C linked list is no different than the list itself, so you can use the pointer to the pointer to the next entry as a pointer to the list. This is a pet peeve of mine. The real beauty of pointers can never be understood unless you understand the indirection they allow. People who grew up with Pascal and were corrupted by that mindset are mentally stunted. Niklaus Wirth has a lot to answer for! But never fear. You too can overcome that mental limitation, it just needs some brain exercise. Reading this patch may help. In particular, contemplate the new "taglist_add_divetag()". Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org> |
||
---|---|---|
.. | ||
css | ||
marble | ||
profile | ||
about.cpp | ||
about.h | ||
about.ui | ||
completionmodels.cpp | ||
completionmodels.h | ||
divecomputermanagementdialog.cpp | ||
divecomputermanagementdialog.h | ||
divecomputermanagementdialog.ui | ||
divelistview.cpp | ||
divelistview.h | ||
divelogimportdialog.cpp | ||
divelogimportdialog.h | ||
divelogimportdialog.ui | ||
diveplanner.cpp | ||
diveplanner.h | ||
diveplanner.ui | ||
downloadfromdivecomputer.cpp | ||
downloadfromdivecomputer.h | ||
downloadfromdivecomputer.ui | ||
exif.cpp | ||
exif.h | ||
globe.cpp | ||
globe.h | ||
graphicsview-common.cpp | ||
graphicsview-common.h | ||
groupedlineedit.cpp | ||
groupedlineedit.h | ||
kmessagewidget.cpp | ||
kmessagewidget.h | ||
maintab.cpp | ||
maintab.h | ||
maintab.ui | ||
mainwindow.cpp | ||
mainwindow.h | ||
mainwindow.ui | ||
modeldelegates.cpp | ||
modeldelegates.h | ||
models.cpp | ||
models.h | ||
preferences.cpp | ||
preferences.h | ||
preferences.ui | ||
printdialog.cpp | ||
printdialog.h | ||
printlayout.cpp | ||
printlayout.h | ||
printoptions.cpp | ||
printoptions.h | ||
printoptions.ui | ||
renumber.ui | ||
shiftimagetimes.ui | ||
shifttimes.ui | ||
simplewidgets.cpp | ||
simplewidgets.h | ||
starwidget.cpp | ||
starwidget.h | ||
subsurfacewebservices.cpp | ||
subsurfacewebservices.h | ||
tableview.cpp | ||
tableview.h | ||
tableview.ui | ||
tagwidget.cpp | ||
tagwidget.h | ||
usermanual.cpp | ||
usermanual.h | ||
usermanual.ui | ||
webservices.ui |