Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#5623 - add a directory walker functoin to reduce code reuse

Attached to Project: Rockbox
Opened by Jonathan Gordon (jdgordon) - Sunday, 02 July 2006, 03:30 GMT+2
Last edited by Jonathan Gordon (jdgordon) - Sunday, 20 May 2007, 10:38 GMT+2
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Player Type All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Private No

Details

this patch adds a directory walker function to reduce lots of code reuse (the same sort of function apears about a half-dozen times in playlist.c alone.. )

this patch also updates the stats plugin to use the dir walker.

edit: may as well mention i did it iterativly in the ope its a bit faster on the player than recursive.
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Sunday, 20 May 2007, 10:38 GMT+2
Reason for closing:  Out of Date
Additional comments about closing:  very out of date and probably not worth adding anyway
Comment by Jonathan Gordon (jdgordon) - Sunday, 02 July 2006, 04:02 GMT+2
ok, realised the recurse variable was completly unnescacery
Comment by Jonathan Gordon (jdgordon) - Sunday, 02 July 2006, 06:51 GMT+2
new version, this one includes the needed tchanges to playlist.c to use the dirwalker.

im not 100% sure why, but get_next_directory doesnt work exactly as it used to now, but that can be figured out later.
also, i was hopeing it would drop the filesize a bit, but apparently not..

h300 size comparisson
-rw-r--r-- 1 jonno users 331980 2006-07-02 14:50 rockbox.iriver <- with patch
-rw-r--r-- 1 jonno users 331700 2006-07-02 14:49 rockbox.iriver.cvs <- without patch

recorder comparisson
-rw-r--r-- 1 jonno users 146732 2006-07-05 00:47 rockbox.ucl <- with patch
-rw-r--r-- 1 jonno users 146692 2006-07-05 00:46 rockbox.ucl.cvs <- without patch

but, imo its worth the extra 280bytes to make it easier later.

ive been told to do speed comparissions, so ill do em tomroow maybe
Comment by Jonathan Gordon (jdgordon) - Wednesday, 19 July 2006, 07:50 GMT+2
synced to latest cvs, fixed some minor bugs
fixed he newly added playlist catalog to use this.

edit: you need the 2 files in the next comment also, forgot to add them and you cant add files to an existing comment
   playlist_and_dirwalker.patch (21.6 KiB)
 apps/SOURCES            |    1 
 apps/playlist.c         |  396 ++++++++++++++----------------------------------
 apps/playlist_catalog.c |   21 ++
 apps/plugin.c           |    1 
 apps/plugin.h           |    6 
 apps/plugins/stats.c    |  101 +++++-------
 6 files changed, 190 insertions(+), 336 deletions(-)

Comment by Jonathan Gordon (jdgordon) - Wednesday, 19 July 2006, 07:58 GMT+2
woops, forgot the 2 most important files, which for some reason didnt get added to the .patch
Comment by Jonathan Gordon (jdgordon) - Monday, 24 July 2006, 10:51 GMT+2
synced, fixed and renamed to fileutils.[ch]
Comment by Jonathan Gordon (jdgordon) - Monday, 24 July 2006, 10:56 GMT+2
woops,
fixed again.. now its ready to go!
Comment by Jonathan Gordon (jdgordon) - Monday, 14 August 2006, 09:00 GMT+2
synced to cvs,
also changed some minor bits so its hopefully faster and smaller...
tested on my h300 and it works perfectly
(application/octet-stream)    playlist_dirwalker.patch (29.3 KiB)
 apps/SOURCES            |    1 
 apps/fileutils.c        |  167 ++++++++++++++++++++
 apps/fileutils.h        |   42 +++++
 apps/playlist.c         |  383 +++++++++++++-----------------------------------
 apps/playlist_catalog.c |   21 ++
 apps/plugin.c           |    1 
 apps/plugin.h           |    7 
 apps/plugins/stats.c    |  101 +++++-------
 8 files changed, 384 insertions(+), 339 deletions(-)

Comment by Matthias Mohr (aka Massa) (mmohr) - Tuesday, 22 August 2006, 12:46 GMT+2
Currently I didn't test it - but it seems to be a very good idea for me!
I had a look at the patch and it makes the code much more understandable
which is IMHO always a good idea :-)

I also like the idea of a fileutil.c -
I assume there are a lot more currently internally used functions/code parts
which which do something for or with files and could be moved to general usage.
Comment by Jonathan Gordon (jdgordon) - Saturday, 30 September 2006, 12:54 GMT+2
synced to cvs
(application/octet-stream)    playlist_dirwalker.patch (29.8 KiB)
 apps/SOURCES            |    1 
 apps/fileutils.c        |  167 +++++++++++++++++++
 apps/fileutils.h        |   42 ++++
 apps/playlist.c         |  419 ++++++++++++++----------------------------------
 apps/playlist_catalog.c |   21 +-
 apps/plugin.c           |    1 
 apps/plugin.h           |    7 
 apps/plugins/stats.c    |  101 ++++-------
 8 files changed, 402 insertions(+), 357 deletions(-)

Loading...