aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Teirney <david@teirney.net>2011-08-08 19:42:23 +1200
committerDavid Teirney <david@teirney.net>2011-08-08 19:42:23 +1200
commit51ce9cf445ce5c51f46febf9c17d4035281d1a44 (patch)
treec2069ded0c0206d3500a6c303ae03ad2fa5b8bfd /lib
parent88bdd5f00c9dc64a885bcf4324ed4f053fcdc1e3 (diff)
Optimize the file seek behavior for libcmyth to return immediately if the requested seek time is the same as the current file position.
Diffstat (limited to 'lib')
-rw-r--r--lib/cmyth/libcmyth/file.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/cmyth/libcmyth/file.c b/lib/cmyth/libcmyth/file.c
index e4508d95dd..e72be643b6 100644
--- a/lib/cmyth/libcmyth/file.c
+++ b/lib/cmyth/libcmyth/file.c
@@ -435,6 +435,9 @@ cmyth_file_seek(cmyth_file_t file, long long offset, int whence)
if ((offset == 0) && (whence == SEEK_CUR))
return file->file_pos;
+ if ((offset == file->file_pos) && (whence == SEEK_SET))
+ return file->file_pos;
+
while(file->file_pos < file->file_req) {
c = file->file_req - file->file_pos;
if(c > sizeof(msg))