From 975af4764d71b3a99573bdd5d8543a3e27af71ef Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 23 Jan 2021 22:46:46 +0100 Subject: [PATCH] remove no longer needed strlen() calls from diskio routines --- compiler/res/prog8lib/diskio.p8 | 9 +++------ examples/test.p8 | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/compiler/res/prog8lib/diskio.p8 b/compiler/res/prog8lib/diskio.p8 index 5f6a8c1d4..3faf8fb8b 100644 --- a/compiler/res/prog8lib/diskio.p8 +++ b/compiler/res/prog8lib/diskio.p8 @@ -424,10 +424,9 @@ io_error: sub delete(ubyte drivenumber, uword filenameptr) { ; -- delete a file on the drive - ubyte flen = string.length(filenameptr) filename[0] = 's' filename[1] = ':' - string.copy(filenameptr, &filename+2) + ubyte flen = string.copy(filenameptr, &filename+2) c64.SETNAM(flen+2, filename) c64.SETLFS(1, drivenumber, 15) void c64.OPEN() @@ -437,13 +436,11 @@ io_error: sub rename(ubyte drivenumber, uword oldfileptr, uword newfileptr) { ; -- rename a file on the drive - ubyte flen_old = string.length(oldfileptr) - ubyte flen_new = string.length(newfileptr) filename[0] = 'r' filename[1] = ':' - string.copy(newfileptr, &filename+2) + ubyte flen_new = string.copy(newfileptr, &filename+2) filename[flen_new+2] = '=' - string.copy(oldfileptr, &filename+3+flen_new) + ubyte flen_old = string.copy(oldfileptr, &filename+3+flen_new) c64.SETNAM(3+flen_new+flen_old, filename) c64.SETLFS(1, drivenumber, 15) void c64.OPEN() diff --git a/examples/test.p8 b/examples/test.p8 index 785428bd7..149056073 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -16,5 +16,7 @@ main { diskio.directory(8) diskio.delete(8, "newname") diskio.directory(8) + + txt.print("---------------------------------\n") } }