changeset 146:fd166dda4361

tweak return value at file_read.cbc
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 15 Dec 2019 14:15:27 +0900
parents 6c81e02e323f
children 06449f2ae0c7
files src/file_read.cbc
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/file_read.cbc	Sun Dec 15 13:57:57 2019 +0900
+++ b/src/file_read.cbc	Sun Dec 15 14:15:27 2019 +0900
@@ -25,16 +25,15 @@
 }
 
 SysRead* createFileReadInstFromFile(struct Context* cbc_context, struct file* f,char* addr, int n) {
-    SysRead* self;
     if (f->type == FD_PIPE) {
-        self = create_piperead(cbc_context, f->pipe, addr, n, next);
+        return create_piperead(cbc_context, f->pipe, addr, n, next);
     }
 
     if (f->type == FD_INODE) {
         ilock(f->ip);
-        self = create_readi(cbc_context, f->ip, addr, f->off, n, cbc_fileread1);
+        return create_readi(cbc_context, f->ip, addr, f->off, n, cbc_fileread1);
     }
-    return self;
+    return NULL; //Error?
 }
 
 
@@ -57,7 +56,7 @@
     goto next(-1);
   } 
   SysRead* read = createFileReadInstFromFile(proc->cbc_context, f);
-  read->read(f,addr,n);
+  goto read->read(f,addr,n);
 }
 
 __code nextFileRead(...) {