]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
file: avoid duplicated code sequence
authorEmil Engler <me@emilengler.com>
Wed, 25 Nov 2020 17:26:56 +0000 (18:26 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 25 Nov 2020 22:39:28 +0000 (23:39 +0100)
file_disconnect() is identical with file_do() except the function header
but as the arguments are unused anyway so why not just return file_do()
directly!

Reviewed-by: Daniel Stenberg
Closes #6249

lib/file.c

index 5f06c4ccab9ce45f083be97c65996f0261fd07f1..a65eb7798d068b55296fd2c98a8ab00c07898e19 100644 (file)
@@ -227,18 +227,8 @@ static CURLcode file_done(struct connectdata *conn,
 static CURLcode file_disconnect(struct connectdata *conn,
                                 bool dead_connection)
 {
-  struct FILEPROTO *file = conn->data->req.p.file;
   (void)dead_connection; /* not used */
-
-  if(file) {
-    Curl_safefree(file->freepath);
-    file->path = NULL;
-    if(file->fd != -1)
-      close(file->fd);
-    file->fd = -1;
-  }
-
-  return CURLE_OK;
+  return file_done(conn, 0, 0);
 }
 
 #ifdef DOS_FILESYSTEM